Think you’ve got a lot on your plate? Think about Marissa Mayer, and then think again. Mayer, 37, just got hired as CEO of Yahoo, the floundering Internet giant, and she’s expecting her first child in October.

Officially, we aren’t supposed to be surprised by this. Employers are legally forbidden from taking into account whether a prospective applicant is pregnant. And those involved with Yahoo’s decision dutifully report that her current condition was “not part of the consideration.”

That’s doubtful. It’s hard to believe that Yahoo did not consider the time and efficiency costs of losing their new CEO to maternity leave. But that’s just it: They did consider her pregnancy, and decided to hire Mayer anyway. For thirteen years, Mayer worked successfully for Google, building an impressive resume, and making herself an attractive hire. Yahoo’s board recognized what many employers do: Hiring women of child-bearing age may create some additional costs, but often those costs are eclipsed by the individual worker’s merits and skills.

Hiring Mayer, while it has generated some publicity, was not just a stunt. It was a business decision. And Yahoo would not have made this decision if it didn’t pass a cost-benefit analysis.

Most pregnant workers aren’t like Marissa Mayer. They aren’t up for consideration to become CEO at Yahoo – a Fortune 500 company – and they don’t have her clout.

What’s the best way to make sure that they too will have the opportunity to continue working and using their skills?

First, it’s time to admit the obvious. There is a reason—and no it’s not because employers are sexist and hate babies—that employers don’t jump for joy when a worker announces a pregnancy. Pregnant women will need time off for medical care, will take leave following the birth of their child, and will have more duties at home that may take them away from their work if they choose to return. And these realities create costs for a business.

Large companies, like Yahoo, can generally absorb the costs associated with maternity leave. But 60-70 percent of jobs in the U.S. are created by small businesses who don’t have the same resources, and who can face real problems with the absence of one worker.

Policymakers who want to protect women often react by pushing legislation to require employers to provide benefits to employees. Yet while such proposals may be well-intentioned, they make it more expensive for employers to hire women who may give birth. Does anyone think that Yahoo would have hired Mayer if they were legally required to provide a year of paid maternity leave as is required in some European companies?

Such mandates, ironically, backfire on those women with the lowest skill set, since employers are less likely to be willing to bear extra costs to keep them on staff.

The solution isn’t costly mandates, but greater flexibility. Most employers recognize that the hassle of having an employee on maternity leave is far less than hiring and training a replacement. Rather than forcing a one-size-fits-all solution to an issue as diverse as the women of the United States, employers and employees should be able to arrive at solutions that work for both parties. Some women, like Mayer, might bring a laptop with them to the hospital. Some women might want a traditional six weeks of leave, while others may be ready and want to come back part-time sooner than that.

The good news is that women and employers have more options; technological advances ease (but don’t entirely solve) the strain of work-life balance for working moms. Tele-commuting, working from home, using smart phones, and sharing “clouds” – these advances are more responsible for women’s progress than any government program.

Congratulations to Mayer on her new position, as well as the upcoming birth of her first child. And congratulations to Yahoo for being flexible and long-sighted enough to recognize that talented women—even new moms—have the potential to be great leaders for a company. I hope that this is the birth of a new model of flexibility and achievement that will multiply around the country.

Hadley Heath is senior policy analyst at Independent Women’s Forum.