BEIJING — Teresa Xu wants to have a baby someday. Like many women around the world, she hopes to freeze her eggs while she works to save money for a future family. The trouble: China bars single women from the procedure.

Ms. Xu, who has a history of women’s rights activism, decided to mount China’s first legal challenge of a law that limits fertility treatments to married couples only.

“The more I think about it, the more unfair I think it is,” said Ms. Xu, 31, a freelance editor. “It feels like my right to choose is always controlled by others.”

A doctor at the obstetrics hospital of Capital Medical University told Ms. Xu that her eggs were healthy but that instead of freezing them, she should just get married quickly and have children. Ms. Xu sued the facility, arguing that by denying her the treatment, it was effectively discriminating against single women.