No all employment discrimination is not illegal and/or unethical.
In some cases a requirement of the job - the knowledge, skill or ability required for the position - simply requires something that an individual within a protected class could not provide. Likewise there are situations where the protected class of the person places others in harm or poses an undue hardship upon the employer to accomodate the employee in his/her position.
For example, if a small employer were to hire a diabled person to do a job that required extremently heavy lifting or other extreme activity, and the employee couldn't do the job without an accomodation that cost the employer $100,000 to implement. If the employer has an annualy revenue of $100,000, it could not stay in business if it granted the application. Thus it could not be a reaonable accomodation to grant the person the requested accomodation to do the job. Ths is both legal and ethical as preserves the company and thee laws on reasonable accomodation do not require an employer offer an accomodation that is unreasonable in light oof the circumstances.
A second example. A dance entertainment group that features women only as part of its artistic expression. A male is not entitled to be hired into that dance group becuase being female is a bonafide occupational requirement of the job. In other words being a female is a necessary part of the position. It is both ethical and legal to not hire a man for the position as the job is legitmatly designated for women only as only a woman could fulfill a key and essential requirement of the position - that being the artistic expression of a woman in the entertainment context.
I believe this answers your question. However, if you need clarification or have follow-up questions regarding this matter, I will be happy to continue our conversation – simply reply to this answer. If you are otherwise satisfied with my response, please leave a positive rating as it is the only way I am able to get credit for my answers. Thank you, XXXXX XXXXX wish you all the best with this matter.