[Read about an outbreak at San Francisco’s largest homeless shelter.]

“The good Lord takes care of the blind and crippled as well as the seniors,” Mr. Deloney said as he gave an impromptu tour of the center’s garden of blossoming trees and flowers.

“We don’t think about the virus in here,” he said.

But, in fact, the virus was about all Sharon Cornu could think about. As the executive director of St. Mary’s, Ms. Cornu was all too aware of how the novel coronavirus is ravaging places where the elderly live in close quarters. Only weeks ago, men in hazmat suits were carrying bodies out of a nursing home in nearby Hayward, where scores of residents were infected.

She was no less fearful of what will happen if the virus begins to hopscotch through the Bay Area’s vast shadow world of homeless encampments. How long, she wondered, could shelters like St. Mary’s stay virus free? The question hit especially hard when officials disclosed that 96 residents in a homeless shelter in San Francisco had tested positive for Covid-19. In New York, at least 23 shelter residents have died from the outbreak.

“None of our procedures anticipated this scale of a global pandemic,” Ms. Cornu said.

The full weight and meaning of this realization first coalesced within Ms. Cornu in mid-March when the order came for the entire Bay Area to shelter in place. At the time, she had 30 homeless seniors in her care at St. Mary’s. They slept in cots a few feet from one another, and there wasn’t near enough space to enforce proper social distancing.

[Track every confirmed coronavirus case in California by county.]

So Ms. Cornu and her staff scrambled to move guests out of St. Mary’s and into every nearby single-room apartment they could find. They sought to reunify others with relatives. Although they could arrange spots for only 19 people, their efforts created enough room to position cots at a safe distance for the remaining 11. Ms. Cornu also had much of her staff work from home, leaving only a skeleton crew of people like Janny Castillo, who found herself choking back tears when they discussed how to protect those who remained. Once homeless herself, Ms. Castillo was terrified of carrying the disease into St. Mary’s.