Employers are allowed to have dress codes that they expect their employees to abide by. What they are not allowed to do is have dress codes that discriminate against people based on their protected characteristics.
It’s about ensuring the dress code does not affect one set of people who share a particular protected characteristic more than the rest. But, that does not mean the employer must apply the same dress code to everyone. It is perfectly acceptable, for example, to expect front-of-house staff to dress well while allowing those working in the kitchen to be somewhat lax.
Here are some examples of how dress codes could be discriminatory:
Outright discrimination against a particular group
An employer cannot do something like require all Korean workers to wear suits and ties while allowing American ones to wear polo shirts and no ties. That would be clear discrimination.
Discrimination by the dress code affects one group more than another
The employer at a summer camp decides all staff must wear shorts. For most people, this probably is not a problem in the warmth of summer. However, people of certain religions do not go around with bare legs. They always keep them covered in line with their cultural beliefs. Forcing them to wear shorts would be unreasonable, so while the dress code may seem harmless to most people, it ends up being discriminatory toward a certain group of people.
You might fear that refusing to dress in the way your employer expects could cause you problems at work, so you might be reluctant to say anything. However, if you have the law on your side, your employer is not allowed to take any action against you for failing to comply. Getting legal help to understand more about how the law applies to your situation is a wise first step if you are unsure about approaching your employer.