49 states are at-will employment states. Legally they can be fired for any reason that isn’t a protected class violation.
According to the article, California law prohibits a company from enacting a policy to that effect. This also extends to things that aren't explicitly partisan. So if a company said "anyone who attends the March For Life or other similar activities gets fired" that would be illegal. They can't take other actions to get employees to refrain from political activity either.
But in this case the company can say "well we didn't cite a policy, we just fired her. We aren't deterring anyone from going to future 'stop the steal' Trump rallies because that's a one off thing." Whether the judge buys that argument is another matter, if this lawsuit ever even gets to trial.