They did not need to. Gym shorts do not provide much protection if your bottom was the intended target and no protection if they went for the top/back of your bare upper thighs which most did. Some overdid it but were able to get away with it because most of the gym teachers were usually very popular with the girls.
In senior school I got on very well with the senior gym mistress but that did not stop her from slapping the legs out from under me if I played up. But even if she sometimes overdid it I still liked her a lot and even became friendly with her after I left school.