SEOUL, South Korea — A group of American and Canadian humanitarian workers who were traveling in North Korea recently had to make a tough decision: leave the country immediately and hope to return to their lifesaving work in the future, or stay in the North and face possible problems trying to go home later.

This time, however, the uncertainty of their situation was not because of the North Korean government, but rather because of the Trump administration’s intention to bar Americans from traveling to the already isolated country. Under the order, announced in July, Americans must leave the North by Friday.

“I didn’t want any of the staff or any of the colleagues to potentially face issues when they were getting out,” said Kim Taehoon, founder of DoDaum, a humanitarian group based in the United States that has organized an H.I.V.-diagnosis and treatment program in North Korea for the past several years. “Because of the uncertainty of the travel ban, we don’t know if we will be able to do on-the-ground work anymore.”

Washington announced the ban in response to the death of Otto F. Warmbier, 22, an American college student who had been serving a 15-year sentence of hard labor in North Korea after being convicted of trying to steal a political poster. Mr. Warmbier died in June shortly after the North released him in a coma. The travel restrictions also reflected the United States’ growing impatience with North Korea over its missile tests and pursuit of nuclear weapons.