President-elect Donald J. Trump said on Monday that he would impose tariffs on all products coming into the United States from Canada, Mexico and China on his first day in office, a move that would scramble global supply chains and impose heavy costs on companies that rely on doing business with some of the world’s largest economies.

In a post on Truth Social, Mr. Trump mentioned a caravan of migrants making its way to the United States from Mexico, and said he would use an executive order to levy a 25 percent tariff on goods from Canada and Mexico until drugs and migrants stopped coming over the border.

“This Tariff will remain in effect until such time as Drugs, in particular Fentanyl, and all Illegal Aliens stop this Invasion of our Country!” the president-elect wrote.

“Both Mexico and Canada have the absolute right and power to easily solve this long simmering problem,” he added. “We hereby demand that they use this power, and until such time that they do, it is time for them to pay a very big price!”

In a separate post, Mr. Trump also threatened an additional 10 percent tariff on all products from China, saying that the country was shipping illegal drugs to the United States.

“Representatives of China told me that they would institute their maximum penalty, that of death, for any drug dealers caught doing this but, unfortunately, they never followed through,” he said.