Addiction is now widely recognized as a mental disorder, and the medical establishment and communities are more likely to treat people with drug dependency as victims of an illness. But this more generous spirit rarely extends to pregnant women in the grip of addiction, who are still widely seen as perpetrators. In 24 states and the District of Columbia, the use of any illegal substance during pregnancy constitutes child abuse, and in Minnesota, South Dakota and Wisconsin, it is grounds for civil commitment: court-ordered institutionalization — say, to a drug-treatment program — regardless of the woman’s wishes or needs (using a drug once doesn’t mean she is addicted to it). In just the past few months, authorities in Oklahoma and Montana have announced new initiatives to prosecute pregnant women who use drugs or alcohol. In Alabama, according to a report by ProPublica and AL.com, at least 479 pregnant women were prosecuted — and some imprisoned — between 2006 and 2015 under the “chemical endangerment” law originally aimed at parents who risked their children’s lives by cooking methamphetamine at home.

This results in a crazy quilt of punitive approaches to pregnant women with drug problems, which vary arbitrarily by region, county and local politics. In New Jersey, a woman on methadone was charged with child abuse in 2011 because her baby had NAS — an entirely predictable outcome of following the standard of care. In Wisconsin, a pregnant woman who told her doctor she had successfully weaned herself off painkillers was forced onto methadone in 2013 by a skeptical judge who decided she still needed treatment — thus needlessly putting her baby at risk for NAS.

Widespread horror at the thought of newborns in withdrawal has led, some experts feel, to a cultural overreaction reminiscent of the “crack baby” hysteria of the late 1980s and early 1990s, which wildly overstated the negative effects cocaine would have on the children of pregnant women who smoked it. “Crack moms” were nearly always represented as African-American, adding racism to the mix of distortions at play in that perceived crisis. Race has worked the opposite way in our current epidemic — indeed, the perception of our opioid crisis as an epidemic, rather than a racial pathology, owes much to the fact that white Americans have been hard hit. But pregnant women are often treated especially harshly. As Lynn Paltrow, executive director of National Advocates for Pregnant Women, put it, “Pregnant women are perceived as their own special class of persons, entitled to fewer constitutional and human rights.” Race and class biases may be active here, too. In a 2013 study by Paltrow and a co-author, low-income and African-American women were more likely than other women to be arrested for possibly causing harm to their fetuses during their pregnancies.

Barry Lester, director of the Brown Center at Women and Infants Hospital in Providence and principal investigator of the Maternal Lifestyle Study, a 16-year landmark longitudinal study of babies exposed to cocaine in utero, told me, “In the ’80s and early ’90s, the initial reports were talking about cocaine causing massive brain damage: ‘These kids are going to be in wheelchairs.’ Then the real data started coming in, showing that, yes, there are cocaine effects, but you’re looking at something more like A.D.H.D. than heart effects and brain damage. You have to realize that there is a certain amount of prejudice against women who use drugs. The expectation — almost the wish — is that there’ll be something wrong with these kids so we can blame these mothers again, like we love to do.”

Health experts deplore the societal impulse to blame and punish drug-dependent women who find themselves pregnant because it discourages them from seeking treatment — even in the 19 states where a publicly funded drug-treatment program specifically for pregnant women exists. Not only does inhibiting a woman from treatment harm both fetus and mother, they say, it also squanders a rare opportunity to intervene constructively in a woman’s addiction. “Sometimes a pregnancy is when women see past their own traumas to have that clarity to move forward,” Dr. Lauren Jansson, director of pediatrics at the Center for Addiction and Pregnancy at Johns Hopkins, told me. “Treatment works, and especially for this population. They have a lot to gain.”

Alicia was alone with her quandary; though her boyfriend welcomed the pregnancy, neither he nor her family knew about her addiction. The only people who did know were those who shared it, and she wanted nothing more to do with them. To her mind, taking Percocet while pregnant was out of the question. But how could she stop? After leaving the women’s clinic, where her pregnancy was confirmed, she tried calling Project Link, a treatment program in Providence for pregnant women with substance-use disorders. When she couldn’t get through on the phone, “I went right up to the building in person. I was a complete mess.” She wondered whether there was a way for her to get help without telling her boyfriend. “Because if I told him, he might not stay with me. He’ll say, ‘You’ve been lying to me this whole time, you’ve been using all of our money.’ ” Project Link advised Alicia to go to the emergency room and start opioid-replacement therapy, rather than go into withdrawal, which could cause her to miscarry. Instead, she purchased the illegal pills she needed to avoid getting sick and sniffed them through the weekend.