WASHINGTON — Citing the threat of the coronavirus to the American public, the Trump administration said on Friday it would begin rapidly sending people who illegally cross the United States borders to their home countries and would halt the processing of undocumented migrants at ports of entry.

Chad Wolf, the acting secretary of homeland security, said the United States would also close the legal entry points along the border with Mexico and Canada to tourism. American citizens, lawful permanent residents and those crossing a border to seek medical treatment or attend educational institutions would not be affected. Commercial traffic would remain open, but port officers would stop processing those without legal authority to be in the United States, including asylum seekers.

Mr. Wolf said the Centers for Disease Control and Prevention had issued the order to turn away any people who crossed the southwestern border illegally instead of taking them to a detention center where they could ask for asylum in the United States. President Trump has sought such a restrictive policy for years, but the courts have blocked it as a violation of due process.

“We’re trying to limit the amount of contact we have with these individuals,” said Mr. Wolf, adding that many migrants who cross the border often lack documents to prove their medical history. “It’s going to be very rapid.”