This is a very controversial subject matter and it may take a few reads to be able to fully understand how it is lawful to discriminate against other workers.
Firstly, lets look at protected characteristics. Most of us know that you cannot discriminate against someone who has a characteristic that is protected under the Equality Act 2010. This could be: religion, belief (inc. Veganism) , age, disability, gender reassignment, sex, sexual orientation, marriage, civil partnerships, pregnancy and maternity.
However, a genuine occupational qualification is used in the context of discrimination of the above protected characteristics, where an employer is allowed to discriminate in recruitment, transfers or training, if the employer can prove that a genuine occupational requirements exists.