I sense it to be a form of sexism.
it may seem like common courtesy to all women, no matter what they're wearing, but the message that comes across to me, is that it's implied all men are voyeuristic rapists in confined quarters and cannot be trusted in any way.
but that's just my opinion. I still think it's a nice thing to do, and I do abide by it, anyway.