Say I'm a business owner, and I get burned by younger women who take the job, get knocked up, take the maximum legal maternity leave (while I pay for the medical insurance), and then decide to quit at the end and not come back. You think that's not going to dissuade me from hiring members of their class (young women likely to become mothers) when there are other applicants in front of me who can't burn me that way?
Yes, it's discrimination. No, I wouldn't tell anyone I'm doing it. I'd fix the demographics by hiring women in their 40s and beyond, when available, thus meeting both gender quotas AND age quotas in one fell swoop. Obviously, I'd have to accept younger women when they're the only ones qualified for (or possibly the only ones seeking) a certain job, but I wouldn't invest the same degree of training in them, knowing they have a propensity to abandon the working world as is convenient to them. It wouldn't be personal, and I wouldn't blame them, but it's still bad for my business to dump money into training employees who are likely to leave at the drop of a hat.
Now if I ran a business where everyone was replaceable, and nobody worked enough hours to get covered medical, I wouldn't give a shit. In fact, the propensity of those same women to leave the job would help reduce the overhead of people staying on too long and expecting ever increasing wages.
I'm not a business owner, and I have no plans to do anything of the sort, but I'd have to be a blithering idiot not to at least consider the problem. I've certainly seen this play out in the real world.