At first I thought there might be some military affiliation with your school, but it sounds like that's not the case.
Any school I attended with a dress code made you sign an acknowledgement of the school's policy at the start of the year. It wasn't anything drastic such as this (I had a stache/goatee in grade 11 and a full beard for much of grade 12), just no obscenities or offensive shirts etc. Unfortunately if you sign the agreement you have to live with it; if there is no agreement then something's wrong and you either put up or move on.