It's certainly illegal to fire someone over that opinion, yes.
There is a limited prohibition against screening for political affiliations enforced by the Federal government when filling certain civil service positions, but that's about it.
For a good summary of what types of discrimination can and cannot trigger legal liability, see here: