MEXICO CITY—Guatemala’s constitutional court granted an injunction late Sunday stopping President Jimmy Morales from signing a controversial immigration proposal that would require migrants from El Salvador and Honduras to seek asylum there rather than the U.S.

Earlier in the day Mr. Morales scrapped a planned trip to Washington to discuss the proposed “safe-third-country agreement” with President Trump. The government had said Mr. Morales was postponing the trip to give the court a chance to rule on injunction requests, and...