Sure, but it’s usually not like that though. All the people who get into med-school are talented even though the selection process was unfair in this regard.
Like I said, this can be an overall good. For example, let’s say I run a small software shop where everybody is male. Now, it’s not likely that a woman would accept a job offer because of the environment. So if I were the boss I’d hold off on hiring until I can get three people at the same time and work hard to make all of them women, to the point I wouldn’t look at male applicants. After that the workplace would hopefully be more balanced and for the next hire gender wouldn’t matter.
Is this unfair towards the men applying? It absolutely is, and that’s why I would only consider this as a one-time thing for a clear and specific goal.
This is in the context of a small private company, I believe nationwide policies need specific goals and targets infinitely more.