Technically, whether you like it or not, it is a law within the British legal system created long ago. Indirect discrimination.
The [job] criteria cannot actually be justified by the employer as a real requirement of the job. So a candidate who cannot meet the criteria could still do the job as well as anyone else.
With Indirect Discrimination an employer can argue that there may be discrimination, but that it is actually required for the job, (this is known as a "geniune occupational requirement" (GOR)).
This does not happen very often, but circumstances where it might occur are, for example, actors who are needed to play certain characters for authenticity. The same can be true for restaurants, for example an Indian restaurant will want Indian staff rather than white staff. Or where race or gender is a genuine occupational qualification for the job, for example, employing women in an all female hostel.
Whilst the owner would have preferred her to not wear the scarf, this would have not preventedd her form doing the job - as the salon owner had suggested.
Unfair? Perhaps, its a matter of opinion. But it wouldn't be the first time someone has said the law is an ass. Maybe one day, the same law will help you.