What law?
The right to free speech is a limited right. There are hundreds if not thousands of examples of organizations disciplining their employees for comments they have made -- even while not speaking as representatives of that organization.
Since it is political speech that reflects a personal opinion, I don't agree with the school's decision to do this, but they are well within their legal rights to do so.