Much like schoolroom dress codes, what is considered workplace “appropriate” is often structured around cultural norms where the ideal is based around the white male gaze. Anything that doesn’t align with it is considered inappropriate, so womens’ attire is expected to conform or else the wearer faces the consequences.
Those could include comments behind your back and to your face, less opportunities, or even formal complaints.
In a less subtle form of discrimination, dress codes can go beyond unspoken rules and even be codified in employee handbooks and policies. Legally, dress codes cannot impose a greater burden based on gender identity – so if your workplace is reaching beyond and forcing you to don an expensive skirt or heels, you may have legal reason to take action.