In June, an Arizona woman was told by her doctor that her nine-week-old fetus had no heartbeat and that she was miscarrying. She was given a prescription for misoprostol, a drug that would help induce her body to clear the dead fetus. She went to a local Walgreens to get that medication, but the pharmacist there refused. Instead he told her she could return when he was not working or have her prescription passed along to another pharmacy. The woman said she was left explaining in front of her seven-year-old and other customers that she had wanted to have a baby but that there was no heartbeat. Yet she was still refused the medication.

In Arizona and at least six other U.S. states, pharmacists have the legal right to refuse to fill emergency contraception prescriptions—not for medical reasons but simply based on moral grounds. In such cases, the law allows druggists in Arizona, Arkansas, Georgia, Idaho, Mississippi, South Dakota and Texas to override the judgment of physicians.

This puts patients at risk—primarily women, because moral qualms nearly always have to do with birth control or with so-called abortion pills. But there are many reasons other than birth control that a woman might take contraceptives, ranging from regulating menstrual cycles to helping manage endometriosis or polycystic ovarian syndrome. Failure to obtain legitimately prescribed drugs could result in significant pain or other medical complications, in addition to the obvious risk of unwanted pregnancy. But in these states, pharmacies and pharmacists can just say no.

Such policies are a particular problem in rural parts of the country where drugstores may be located very far apart, forcing people to travel significant distances to find a cooperative pharmacist. There are no official tallies on how often such incidents occur, although some anecdotal examples of such arbitrary refusals are chilling. In January 2007, for example, a 23-year-old mother in central Ohio went to her local Walmart for emergency contraception.

According to the National Women's Law Center, the pharmacist on staff “shook his head and laughed” and told her that no one there would sell her the medication even though the store had it in stock. As a result, she had to drive 45 miles to find another pharmacy that would provide her with the drug. This woman's experience is particularly worrisome because delays taking emergency birth-control medication can increase the odds of pregnancy.

In states with “conscience carve-outs” for druggists, pharmacies honoring those policies should be required to preemptively notify state authorities and medical providers that they might refuse service. That way, women and their doctors could make alternative arrangements to fill prescriptions at pharmacies that will give them the medications they need—avoiding situations such as the recent one in Arizona. This follows a model worked out in 2014, when the U.S. Supreme Court told the Obama administration that certain employers with religious objections did not have to offer an insurance plan with birth-control coverage. But these employers did have to notify the Department of Health and Human Services so the government and insurers could provide birth-control coverage via a private insurance plan or a government-sponsored one. (The Trump administration has since complicated this approach and scrapped government notification requirements.)

And in situations where individual pharmacists may refuse service—even if their pharmacies generally fill family-planning prescriptions—there should be a legal requirement to automatically refer that prescription to another pharmacy within a certain reasonable distance or to have a backup druggist on call to do the work so that patients can get medications quickly and efficiently.

Pharmacists play a vital role in the health care system: helping patients treat illnesses, maintain their health, educating them about drug interactions and answering questions. But these professionals are hurting people—especially women—when they force them to go hunting for a place to fill a prescription.