When Sayaka Osakabe returned to work after a second miscarriage, one of the first questions her boss asked was whether she was having sex again.

Despite laws guaranteeing equal opportunity and a near parity of sexes attending university, Japanese women have yet to gain an equal footing in the workplace.

Prime Minister Shinzo Abe has talked up the role of women in his push to revive a weak economy, pledging that they would occupy 30 percent of all leadership positions by 2020.

But Osakabe and others say the reality for regular female workers is bleak.

“Rather than focusing on a small portion of elite women who are top managers, I’d like them to start by dealing with problems affecting women like us at the bottom,” the 37-year-old Osakabe said.

With an aging population and low birthrate, lawmakers and economists say Japan must encourage more women to both work and have children.

After winning a settlement through a labor tribunal in June, Osakabe has been speaking up on behalf of pregnant women and young mothers who are harassed at work. Their plight has spawned a new term: “matahara,” a shortened form of maternity harassment.

Osakabe’s case has pushed bullying over pregnancy at work into the media spotlight, and coincides with the first-ever hearing on maternity harassment in the Supreme Court.

The court case involves a woman who was demoted during pregnancy. The plaintiff, who is seeking anonymity for fear of a backlash and trouble at her new job, is suing for about ¥1.7 million in compensation plus costs. A verdict is due Oct. 23.

Both moves come as more women are continuing to work after having children, partly because a downtrend in wages since the late 1990s has made life harder for single-income families.

As of 2010, 46 percent of working women stayed in their jobs after having their first child, up from 32 percent in 2001, according to the labor ministry.

At the same time, complaints about harassment and discrimination related to pregnancy and childbirth have risen. In the year to March, the government received 2,085 such complaints from female workers, up 18 percent from six years ago.

Women are guaranteed by law to the right to seek less physically demanding roles during pregnancy. Laws also guarantee 14 weeks of maternity leave surrounding childbirth and allow for child care leave, which can be used by either parent until their child’s first birthday and can be extended in some cases.

Yet many women find it difficult to take advantage of those policies in the face of traditional expectations for them to focus on housework and child rearing, as well as their relatively insecure positions in the workforce.

Lawyers say contract workers often fear their employment will not be renewed if they take maternity or child care leave. Last year, around 56 percent of women were hired under part-time or temporary contracts, compared with 21 percent of men working under such arrangements.

Osakabe was one of those contractors, editing a quarterly newsletter. After a first miscarriage, she asked her boss for help to cut back her workload. She said he told her “to put off pregnancy for two to three years and focus on work.”

While she was taking bed rest during her second pregnancy, her boss visited her at home and encouraged her to resign, saying her absence “caused trouble.” Determined to stay, she returned to work, only to suffer another miscarriage.

According to Osakabe, it was after her second recovery that her boss asked whether she and her husband were having sex.

“My boss told me to come over, and asked if I was menstruating again and if we re-started ‘baby-making,’ ” she said.

Osakabe later resigned and took her case to a labor tribunal.

As part of an agreed settlement, she can’t disclose the name of the company or the individuals.

An articulate speaker, Osakabe has formed a support group called Matahara net, and has called for legislation to provide more support for working women in an extraordinary session of the Diet starting next week.

The plaintiff in the Supreme Court is a physical therapist who was demoted after asking for a less physically demanding role when she was pregnant with her second child.

Her employer, a medical cooperative called Hiroshima Chuo Hoken Seikatsu Kyodo Kumiai, withdrew her management title when it moved her to a job in a hospital from a previous role that required house calls.

The cooperative has said the removal of the title was unrelated to the plaintiff’s pregnancy. Masaki Ohno, a cooperative official, said there was already someone in a similar managerial role in the team the plaintiff joined.

Two earlier trials in Hiroshima found in favor of the cooperative. But the plaintiff’s attorney said a reversal in the Supreme Court could set a precedent and empower women to shift their roles while pregnant without the fear of being demoted.

Christine Lagarde, the head of the International Monetary Fund, said on a visit to Japan earlier this month that without giving women more power, the country’s aging population will diminish economic vitality and living standards.

“There is one obvious option for rescuing Japan from this harsh economic fate — empowering women,” she said.