That's not exactly uncommon in the modern world. Especially with the prevalence of social media, expressing your opinion on anything publicly could cost you your job. Same thing happened to James Damore.
If you want to remain employed, you need to be quite cautious about what you post on non-anonymous social media. In fact, I'd advise most people not to post on social media at all.