That question is arising across the country as a growing number of parents have begun to withhold access to their children from former spouses or partners over fears of infection, according to families, lawyers and judges. For health care or other essential workers, the battles are infused with heightened controversy. Some say they shouldn’t be punished for doing crucial services; their counterparts argue that the jobs pose too great a risk to other family members.

“If there’s an imminent threat to the kid’s well-being, you must take action, whether that’s something like drug abuse or a virus,” Mr. Surdukowski said. “Watching the news, looking at the cases of doctors being sick, you cannot tell me that they are not at a higher risk.” Mr. Surdukowski, who has an underlying condition, had told the judge that he was also concerned about his own health.

Amid the pandemic, the landscape of family law, which varies across the country, has become more uneven, with few guidelines to address the current safety concerns. Families of medical workers aren’t the only affected. Other parents are arguing over who comes and goes from each home, whether children should be on the playground and if travel to more remote areas should be permitted.

“What we are recommending is to figure out a way for visitation to go forward, and if there’s an emergency worker, to figure out how to salvage it as best as you can,” said Susan Myres, president of the American Academy of Matrimonial Lawyers. “We can’t make those people have to sacrifice more, but how do we do that custody safely?”

Some courts have issued administrative orders addressing the coronavirus crisis. For example, the state district court in Davidson County, Tenn., said that the “primary residential parent” should take custody of the child within four hours of a shelter-in-place order and retain sole custody until the order is lifted.