“This is our new statement: The system is full,” the president said last April.

At the time, top aides to the president convinced him that it was not legal to simply turn away all migrants seeking to enter the country. International treaties and American law require asylum seekers to have an opportunity to present their case, although a related policy now allows the administration to make some wait on the Mexican side of the border for their asylum hearings.

The Trump administration has previously tried to push through a policy that would deny asylum to migrants who illegally crossed the southwestern border, an effort the Supreme Court refused to allow in 2018.

But officials insisted on Tuesday that the new policy was not meant to achieve the president’s immigration goals. They said it was driven by the president’s health advisers and would be in effect only as long as the coronavirus remains a threat to the United States.

Officials said the new policy would be based on authorities that can be granted to public health officials in the time of a medical or health emergency, not on immigration laws that the administration has repeatedly cited as justification for past actions at the border. Another official said the administration would invoke a federal legal code that says if the surgeon general identifies “any communicable disease in a foreign country,” he or she can prohibit people from that country from entering the United States.

The new policy also applies to the northern border with Canada, which has already closed its borders to most foreigners — but not Americans — in an attempt to keep the virus at bay. Officials said Mr. Trump would soon also take separate action to further insulate the United States from the possibility of the virus spreading from Canada.

In the next 24 hours, one official said, the United States and Canada plan to issue a joint statement saying that they are suspending nonessential travel between the two countries. That would allow trade to continue, but would restrict flights and border crossings for things like vacations.