Dr. O’Connell noted that some shelters outside of the study have reported very high rates of positive test results with little prior indication of infection. He said that 49 residents out of 114 (43 percent) tested positive at a shelter in Worcester, Mass., and very few of them had noticeable symptoms beforehand.

“That was before they had a cluster,” he said. “What we really need to be doing is testing early and often in shelters.”

The C.D.C. study said that approximately 1.4 million people nationally use homeless shelters each year. It added that infection-control practices at shelters are especially important, but they can be challenging because of overcrowding, the older age and underlying health conditions of many homeless people, a lack of hand sanitizers and the difficulty of keeping guests sheltering in place.

Dr. Georgina Peacock, a leader of the C.D.C.’s Covid-19 Response At Risk Task Force, noted that many of the study’s findings also apply to the population at large: Early and regular testing, followed by isolation, is vital to controlling the spread of the disease.

But she said these issues are magnified at shelters because of the conditions found at many of them.

“This is a vulnerable population,” she said, “and it is difficult in homeless shelters to do some of the things that we know are important to contain spread.”

In all, officials tested 1,192 residents and 313 staff members. Five of the 19 shelters had clusters of two or more people known to have contracted the virus before the testing was done. Those were the ones with high rates of infection.