The Equality Act 2010 has a specific exception of this very case. The whole bit below for reference, but in relevant parts in bold
Single Sex services, para 27:
27(1)A person does not contravene section 29, so far as relating to sex discrimination, by providing a service only to persons of one sex if—
(a)any of the conditions in sub-paragraphs (2) to (7) is satisfied, and
(b)the limited provision is a proportionate means of achieving a legitimate aim....
From the explanatory notes to para. 27:
738.These exceptions would allow:
a cervical cancer screening service to be provided to women only, as only women need the service;
a fathers’ support group to be set up by a private nursery as there is insufficient attendance by men at the parents’ group;
a domestic violence support unit to be set up by a local authority for women only but there is no men-only unit because of insufficient demand;
separate male and female wards to be provided in a hospital;
separate male and female changing rooms to be provided in a department store;
a massage service to be provided to women only by a female massage therapist with her own business operating in her clients’ homes because she would feel uncomfortable massaging men in that environment.
More here: www.aroomofourown.org/a-uk-guide-for-non-lawyers-about-protecting-women-only-spaces-june-2016/