The president told reporters that if Mexico cannot restrict the flow of asylum seekers trying to cross into the United States, and if Congress cannot agree to several immigration restrictions that Mr. Trump has long pushed for, “the border is going to be closed.”

While 76,000 migrants crossed the border in February, that number is nowhere near the migration levels seen in the early 2000s. And a majority of the migrants crossing the border now are Central American families looking for asylum, as opposed to Mexican individuals looking for work. Homeland security officials could quickly deport Mexican individuals seeking employment, but, by law, they cannot swiftly deport Central American families or unaccompanied children.

Homeland security officials have said they expect the number of crossings to surpass 100,000 this month. And a senior department official said those traveling in and out of ports of entry were already feeling an effect: There was a three-hour wait at the port of entry in Brownsville, Tex., according to the official, and there were around 150 trucks backed up and waiting to cross at Otay Mesa, in California.

On Monday, Kirstjen Nielsen, the homeland security secretary, said she would divert up to 750 border patrol officials from ports of entry to areas in between the ports to handle large groups of migrants crossing the border. A senior homeland security official also said the administration could start closing traffic lanes at the ports.

“The crisis at our border is worsening,” Ms. Nielsen said, “and D.H.S. will do everything in its power to end it.”

Senator Lindsey Graham, Republican of South Carolina and one of Mr. Trump’s external advisers, has been urging the president to ease off the threat. On Tuesday, Mr. Graham portrayed Mr. Trump’s latest broadside as less an eventuality and more a calculated bargaining position.

“You are taking a bad problem and, by closing the ports of entry, you are creating another problem,” he said during an interview. “To the extent that he wants to redeploy resources to the points of entry to deal with the ungoverned spaces — that will create economic upheaval, but that will hopefully lead to a solution.”