The directive has nonetheless upended the personal lives of many ambassadors, who are scrambling to secure living arrangements and acquire visas allowing them to remain in their countries so their children can remain in school, the diplomats said. They spoke on the condition of anonymity because they were not authorized to comment publicly on the matter.

In Costa Rica, Ambassador Stafford Fitzgerald Haney is hunting for a house or an apartment as his family — which includes four school-age children and his wife, who has been battling breast cancer — struggles to figure out how to avoid a move back to the United States with five months left in the school year, according to the diplomats.

In the Czech Republic, they said, Ambassador Andrew H. Schapiro is seeking housing in Prague as well as lobbying his children’s Chicago-based school to break with policy and accept them back midyear. In Brussels and Geneva, Denise Bauer, the United States ambassador to Belgium, and Pamela Hamamoto, the permanent representative to the United Nations, are both trying to find a way to keep daughters from having to move just months before their high school graduation.

Ronald E. Neumann, the president of the American Academy of Diplomacy, a Washington-based nonprofit association for former ambassadors and senior diplomats, said it was reasonable to expect ambassadors to return at the end of a term, given that they are direct representatives of the president with broad grants of authority. But he could not recall an occasion on which such a strict timeline had been applied.