A dress code that unjustifiably discriminated against someone on the grounds of his or her religion would be unlawful. However, establishing (for example) that the wearing of a cross or a headscarf is an important requirement of your religion may not be automatic.
A considerate employer should recognise a genuine claim that you are prohibited from dressing in a certain way. An example of good practice in this area is how the Metropolitan Police approach the issue of headwear. Male Sikh officers can wear turbans, and female Muslim officers can wear specially designed headscarves.