The school is within grounds to fire teachers that are needlessly disruptive to the learning of students. Obviously students in the class found it offensive, and the parents found it totally inappropriate.
Whether you find it unfair or not, that is how education works. The same rules allow schools to keep holocaust deniers, racists,etc from teaching kids. Take away those rules, and Neo Nazis, IS/Al Qaeda supporters, and David Irving will be teaching US history. Because that too is 'free speech'.
Nobody disputes they have the right to do so. It's their school.
The larger question is, what is
served by taking the action they did?
Answer: not a damn thing.
Teachers should take into consideration the students they are teaching, the opinions of parents and students, as well as the school board.
It isn't a question of fairness or what was served by it.
There are exceptions (and this school board might even be wrong in it's decision), but do you deny that it might upset some students and parents, for those teaching their kids to step on the US flag?