Why?
To prevent unjust discrimination based on those factors, because it should be irrelevant to whether or not they can do the job or how much you would pay them.
An employer, for example, might believe that married women are likely to get pregnant and have to take maternity leave, disrupting their operations. Or they may want to pay a married woman less because supposedly her husband is the main bread winner. Or a family may cost more on the company insurance plan than an individual. Or a member of a particular religion might have to take certain days off. Or you just might not like members of a particular religion and don't want to hire them for that reason alone.
Okay. That’s fine for government jobs financed by tax dollars.
But is a private employer a private employer, or not?