The U.S. and Mexico have agreed to curtail travel across their shared 2,000-mile border, allowing trade and workers to continue crossing but limiting most other travelers, including migrants, in response to the coronavirus pandemic.

President Trump announced the move from the White House briefing room Friday, saying it was necessary to slow the spread of Covid-19, the illness caused by the virus, across North America and “reduce the mass global migration that would badly deplete the health-care resources needed for our people.”...