FORTUNE — Dear Annie: I am a senior software developer with one daughter, and I just found out I’m expecting a second child. This is great news, of course, but the problem is, my first pregnancy was very complicated, requiring several weeks of bed rest (i.e., absence from the office). Luckily, my boss back then was sympathetic, and I could work from home most of the time without any major problem.
This time, though, I’m working for a different company, and my boss and teammates are all single men who have not been very accommodating, to put it mildly, when the few other women here have taken pregnancy leave, maternity leave, etc. Should I tell my boss now that I might have to be out for a while? Or should I wait and see? On the one hand, I don’t want to seem as if I’m hiding anything, and I do want to give him enough advance notice to come up with a Plan B. On the other hand, I hesitate to bring this up, in case there are repercussions. Your thoughts? — Due in October
Dear D.I.O.: First, congratulations! And second, here’s hoping you work for a company that has 15 or more employees because, if so, the federal Pregnancy Discrimination Act of 1978 protects you from most of the ominous-sounding “repercussions” you refer to. “Knowing your rights is key,” says Tom Spiggle, an attorney and author of the forthcoming book, You’re Pregnant? You’re Fired!: Protecting Mothers, Fathers, and Other Caregivers in the Workplace.
At most big companies with vigilant legal departments, he notes, managers are at least vaguely aware that they can’t take any adverse action, including firing or demoting you, just because you’re expecting. Even so, the number of pregnancy discrimination cases filed with the federal Equal Employment Opportunity Commission has been rising for the past decade or so, falling slightly since 2010, from 4,029 to 3,541 last year.
The prevalence of these cases, Spiggle speculates, is “probably because there are more women in the workplace, and more of them are delaying childbearing until they’re farther along in their careers, so the stakes are higher.” He adds that, in predominantly male businesses (like software development, for example), “front-line supervisors may not be too familiar with the law.”
Whether or not your boss belongs in that category, Spiggle advises you to “tell him you’re pregnant as soon as you’re sure. But, if you’re not experiencing any complications yet, don’t bring up the possibility.” If and when medical difficulties arise that can be documented by a doctor, you may qualify for protection under a different federal law, the Americans with Disabilities Act, which requires employers to make “reasonable accommodations” for people with health issues. “But until then, it’s only hypothetical,” Spiggle says. “So there’s no reason to mention it.”
Elaine Varelas agrees. “At this point, give your boss and your team as much information as they need, but no more than that. Don’t get into the ‘what ifs,’ which most people already know could occur, anyway, without your having to spell it out.” A managing partner at executive coaching and development firm Keystone Partners, Varelas was the first woman at her company to take a maternity leave 18 years ago.
Varelas notes that anyone who expects to be away from the office in the future for any reason — whether it’s “a vacation, a honeymoon, a medical leave, or a maternity leave” — should make a detailed plan. “Your goal is to make sure that everything runs as smoothly as possible during your absence,” she says.
In particular, organize and document everything you’re doing as thoroughly as you can. “You need to make it very easy and painless for other people to find information on your contacts and the status of your projects if you’re not there and can’t be reached,” she says. “When people can’t find things, that’s when they get upset and start questioning your professionalism.”
Speaking of documenting everything, let’s get back to your concerns about repercussions. Maybe there won’t be any. But after some time, if you have reason to believe that you’re being, for example, passed over for promotion or denied plum assignments because you’re pregnant, “report it in writing to human resources,” Spiggle says.
On top of your other legal protections, the federal Family and Medical Leave Act, which covers companies with 50 or more employees, prohibits employers from retaliating against anyone for taking unpaid time off to deal with a medical condition. Creating a clear paper trail “can make it a lot easier to support your claim if it turns out that you have one.” Good luck.
Talkback: If you’ve ever been expecting a child while working, or if you took a parental leave, how and when did you tell your boss? Leave a comment below.