If it is a public school, the teacher has a right to a hearing before being fired. If the teacher is a member of a union, the union should provide legal counsel to represent the teacher.
If it is a private school, the teacher is generally employed at will and can be fired for any reason or no reason at all.
Of course, any good employment lawyer would look into whether the termination was a pretext for discrimination on the basis of gender, race, age or national origin. If the post related to union activity, termination could violate the National Labor Relations Act.
Teachers are generally in short supply these days. It is highly unlikely that any district would fire a teacher for posting about supporting one side of a mainstream political issue. The teacher usually ends up crossing a line that has nothing to do with political speech. In my district, a second grade teacher got fired for being a regular caller to a local conservative political talk show. She got terminated when she made some very vulgar and racist comments on the show. She tried to claim her first amendment rights and lawyered up. But they caved pretty quick and agreed to resign in exchange for a few weeks of severance.