In the 1940s and 1950s when I was growing up, the compartments of trains intended for long distance travel were connected by a narrow corridor along one side. Frequently stopping trains had no corridors.
The corridors were useful for walking along to find a seat on a crowded train and to reach a lavatory at the end of the corridor.
Where there was no corridor, it was a sign of the times that my mother would walk along the platform choosing her compartment according to there being no man alone in it. Only a compartment with at least one woman was considered appropriate, and it was best if she was elderly. Apparently there had previously been 'Ladies only' compartments, but I don't remember them.
If you can add anything to this page or provide a photo, I would be pleased to hear from you.