CAMPINA GRANDE, Brazil — Marina Leite arrived at a hospital from her rural village in February, 28 weeks pregnant and struggling to speak or breathe.

She was carrying double the normal amount of amniotic fluid, a life-threatening complication that, her doctors told her, stemmed from severe fetal deformities linked to the Zika virus.

A week later, Ms. Leite, 35, had an abortion.

“I followed my heart and my doctor’s advice for my survival,” she said.

In almost all circumstances, abortion is a crime in Brazil, punishable by up to three years in jail. But in Ms. Leite’s case, because of the risk to her health, the abortion was considered legal and the doctor was willing to perform it.