From the railway bye-laws of 1906:
"Except by express permission of a guard of the train, a person of the male sex above, or apparently above, the age of eight years shall not travel or attempt to travel or remain in any compartment of a carriage marked or notified as being reserved or appropriated for the exclusive use of persons of the female sex. Any person infringing or not observing this by-law and regulation shall be liable to the penalty prescribed by By-law No. 1, and on failure to quit such compartment immediately on request by a guard of the train or any duly authorised servant or agent of the company, may, without prejudice to any such penalty, be removed therefrom by or under the direction of any such guard, servant or agent"
At that time the penalty for the infringement of the by-law was £2 for the first offence, and £5 for each subsequent offence.
As Mike mentions, many British trains had 'Ladies Only' compartments up until 1977.