On a purely theoretical basis, I’d say yes. As has been said before, it’s a school’s responsibility and prerogative to create a safe, appropriate and constructive learning environment for students.
Also, I agree with Jack that it’s a school’s responsibility to teach life skills (which is why we have Health classes). In my own ideal (and purely theoretical) world, schools exist to teach what families can’t or don’t–we’re all human and need to work together to fill in each other’s gaps.
So, purely theoretically, it’s within a (same sex) teacher’s right to pull a student aside and talk through what kind of attention their outfit might draw, and what’s a better choice to wear to school, given the rules. This qualifies as a life lesson: it’s key that one learns how to dress one’s self. I don’t know that it’s a good subject for a whole, mixed classroom, except in very general terms. (“Now, on your worksheets, circle which butt you’d find distracting in the hallway…”)
I also don’t think that it’s fair for students to be punished for accidental dress code infractions. After all, many girls with new curves simply haven’t realized that the pants they wore two years ago don’t look the same on them now (especially if Less Developed BFF does look the same as she used to). But better that they hear that straight from, if not Mom or Friend’s Mom or Cool Aunt, then Mrs. FavoriteEnglishTeacher, than slowly figuring it from peers’ reactions, which won’t be so nice.
BUT–good luck finding the teachers who handle that discussion effectively and sensitively. I know they exist, but they’re truly exceptional people. If we accepted targeted dress coding as appropriate, I think we’d see many more teachers like the one above*, who with the best of intentions could destroy a student’s body image, as well as those who broach the subject too vaguely and leave the student confused. We’d also open the door to a lot of power tripping and general creepiness.
In conclusion, I’d say targeted dress coding is ethical as a concept, but like many other issues, I question anyone’s ability to execute it.
(By the way, if I were in charge, I’d ban yoga pants in school–fashion aside–for the same reasons I’d ban pajamas and sweats. Leggings may be worn under regulation length skirts or shirts.)
*Keeping in mind that we’re hearing the student’s side of the story here.