First, the right of free speech is not absolute for anyone. Slander, inciting to riot and child pornography are examples of unprotected speech.
Second, minors’ rights are further circumscribed for their protection and instruction. This may seem unfair. You are 17, only one year from being legally an adult. But the line has to be drawn somewhere, and right now, for many things, that age is 18.
Finally, the atmosphere of a school is a special case. Teachers have the obligation to ensure that all students have the opportunity to learn. If one student is being disruptive, for example by using foul or hateful language, others are being robbed of the chance to learn in a non-threatening atmosphere. (Now if teachers are shutting students up because they don’t want to hear an opposing viewpoint, that’s another issue, one that probably should be addressed by parents.)
Look on these restrictions as a challenge. It is really an opportunity to grow. In the adult world you will not always be able to say what you want, when you want, to anyone you want. People will challenge your views, and you will have to defend them with a logical, reasoned argument. You will frequently have to use tact, diplomacy and a sense of decorum (being able to discern the proper time and place to make your point). High school is a good place to learn.