LOS ANGELES — The woman said she was racked with pain and disbelief on the hospital bed, her belly slick with ultrasound gel, when a hospital worker delivered the news: There was a baby inside her.

It was a boy. Six months along. And his heart wasn’t beating.

For months, the 30-year-old woman had waved off her swelling belly and ankles. Pregnancy seemed impossible because she had struggled to conceive in the past. Besides, she said, “you put all the bad thoughts on the back burner when you’re high.”

It wasn’t until days later, as she grieved her unexpected baby at home in Los Angeles County, that a nurse called to tell her what happened, she said. She calls it “the S,” an illness she is still embarrassed to name.

More and more babies in the county have been infected with syphilis in the womb, which can lead to stillbirth, neurological problems, blindness, bone abnormalities and other complications. Nine years ago, only six cases were reported across the county, according to a Department of Public Health report. Last year, that number reached 113.

The numbers were already surging before the arrival of COVID-19, but public health officials fear the pandemic exacerbated the problem, closing clinics that screen people for syphilis and other sexually transmitted infections and putting new efforts to battle the disease on ice.

The woman whose baby was stillborn, who spoke on the condition of anonymity to protect her privacy, said she had avoided getting any medical attention despite having painful sores.

At the time, she said, she feared that going to a clinic could lead to her being jailed for using meth. “You think, ‘I’m going to get in trouble because I’m high,’ ” she said.

The surge in congenital syphilis has been especially frustrating to experts because the illness can be thwarted if pregnant people are tested and treated in time. Other countries have been credited with stopping mother- to-child transmission of syphilis, including Thailand and Belarus.

Federal officials once thought the United States was on the verge of joining them. Instead, cases of congenital syphilis have skyrocketed nationally, from 334 cases in 2012 to more than 2,000 in 2020.

Experts have tied the broader rise in syphilis to a tangle of factors including methamphetamine use and sex without condoms. Men who have sex with men have been especially vulnerable, but the accelerating numbers among women and babies have spurred particular alarm for health officials because of the potentially devastating consequences.

Syphilis is curable in an infant if detected and treated in time, but if a mother also is HIV-positive, a syphilis infection can drive up the risk of transmitting HIV to the baby by breaking down the natural barrier of the placenta, said Dr. Mikhaela Cielo, a pediatric infectious-disease doctor at Los Angeles County-University of Southern California Medical Center.

The illness has behaved as a kind of grim prism, refracting societal problems such as addiction and homelessness. In Los Angeles County, up to two-thirds of mothers who passed syphilis to their babies said they had been using drugs while they were pregnant, according to Department of Public Health studies of cases between 2016 and 2018. Between 10% and 20% were unhoused. Forty percent never got prenatal care. And almost 30% had a history of arrest or incarceration.

The disease also reflects racial inequality: The vast majority of syphilis cases reported among women of reproductive age in the county have affected Latina and Black women, according to county statistics.

Jennifer Wagman, an associate professor of community health sciences at the University of California, Los Angeles, said the rebounding numbers of congenital syphilis across the country are a sign of missed opportunities to stop the disease. Researchers have found that nationally, not all pregnant people are screened for syphilis despite the urgings by health officials.

Even when they are diagnosed, nearly a third of pregnant women with syphilis did not get the care they needed, according to an analysis by the U.S. Centers for Disease Control and Prevention. Wagman said many reasons are tied to other problems in their lives: Some are uninsured. Some may have gotten tested but never got results or treatment because they have no regular address or phone number.

And some fear that if they see a doctor and are found to be using drugs, they could be forced to give up their child. A Los Angeles County report found that between 2016 and 2018, at least 30% of babies with congenital syphilis were put into custody of the Department of Children and Family Services. County officials said doctors may report concerns about child safety to the DCFS, but it is “only in the most extreme cases” that an infant would be removed, following an assessment that occurs after birth and not during prenatal care.

Some experts see the resurging illness as a symptom of shortchanging sexual health. Jeffrey Klausner, a clinical professor of population and public health sciences at the University of Southern California, said federal funding fell off roughly 15 years ago, followed by cutbacks for public health agencies due to the ensuing recession.

The pandemic hasn’t helped. A state survey found that in the majority of health jurisdictions that responded, more than half the workforce had been reassigned to COVID-19 duties as of last September.

Reported cases of syphilis have fallen across California, but officials caution that could be due to less testing. Many of the clinics where the Los Angeles County Department of Public Health provides STD screening, diagnosis and treatment were temporarily closed amid the pandemic.

A rare exception is a mobile clinic on skid row, launched during the pandemic by Los Angeles Christian Health Centers, the People Concern and the county public health department, to test people for sexually transmitted infections.

To reach people who are marginalized, “you have to be out here looking for them, making them feel safe,” said Ciara DeVozza, director of the C3 homeless outreach team on skid row for the People Concern. “That’s not how the medical system is designed.”