Should a professor intervene if a student in their class is wearing clothing that is likely to be offensive and hostile to other students? If so, how?
Maybe.
A professor should hold a discussion with a student when that student is in violation of the school's code of conduct.
If the clothing isn't in violation of the school's code of conduct, a professor will have to decide whether asking the student to desist is worthwhile or not. In some specific situations, asking a student to stop doing something may actually bring about a situation where they start intentionally coming close to, but not quite, violating the university code. In that case they may be offensive more frequently than they are currently, randomly picking out what to wear each day.
Are there any scenarios in which a professor should not do anything even though a student's clothes contains material that is hostile towards another student or group of students?
If it isn't against the school's code of conduct, the professor has little room to insist that certain clothing not be worn, but they can request a student stop wearing such clothing.
As above, though, it may actually exacerbate the problem.
If I come across this scenario as a TA, in which a student (who may be a peer in my program of study) in my class is wearing something offensive, what can I do about it?
We will assume, for the moment, that the clothing in question is not against the school's code of conduct, but it offensive to everyone, in every time, every situation, culture, place, etc.
First I'd evaluate how often it occurs. Is this student consistently bringing offensive messages to class, or is this a once or twice a semester problem?
Second, I'd evaluate how much it affects the class. Is the message visible to every student in class throughout the period, printed on the upper back with the student sitting in the front row, or is it hard to see except when the are standing up with arms at their sides, and then only by the instructor? In either case, does it prevent other students from paying attention, learning, asking appropriate questions?
Third, I'd ask others how they felt about the issue. Does it actually bother them, and did it bother them before you brought it up? I'd make sure this isn't merely a slight against me only.
Lastly, I'd decide, based on this information, if intervention is necessary. If it poses a significant, frequent problem, then I'd probably bring it up. If it poses a significant infrequent problem for a few students, I'd probably bring it up.
A simple, "Please don't wear that shirt to this class again," privately and quietly as they walk out of the class might be sufficient for most cases. Some professors excel at public shaming in a simple effective way. A humorous comment during the lesson referencing the student's poor taste in clothing might dissuade them from wearing similarly offensive clothing.
I don't feel comfortable (or safe, for that matter) as a woman confronting a male student about an item of clothing that is offensive to women.
That's a real problem. If they are communicating something, and you, who are in charge of the classroom, choose not to communicate, then who is going to handle the problem?
If you must, get a third person to back you up. Preferably someone with authority, and make sure the student understands not just that it's inappropriate, but how it makes you feel. If it's not just offensive, but threatening, to you then you have all the more reason to make your work environment safe. Tell your instructor that you can't teach a class where students are threatening you, and that you find certain articles of clothing threatening. Make your case according to the student code of conduct and it'll be that much stronger.
But you really shouldn't take a passive role in your teaching. You are learning skills now that will benefit you as an educator later, if that's the career you choose, and you need to learn how to do hard things. This might be one of them.
On the other hand, I feel like it is my responsibility to keep a non-hostile environment in my classroom.
Not just for the students, but also for yourself.