I read about this decades ago, so I don't have exact country by country information. However, it has been a tradition throughout History that when war occurs, ambassadors have been granted "safe passage' out of the hostile country.
In WWII as in World War I before and because of the number of belligerents involved, there were 3 categories of actions took by differing countries from what I can remember.
- Host Country granted safe passage out by a time specified
- Host Country effectively put Embassy and personnel under "house arrest;" if they had to leave the Embassy compound, they went under guard and were returned under guard.
- Host Country interned all Foreign personnel in a prison camp.
These modern times, post WWII, with the rise of International Revolutionaries, all those old archaic bourgeoisie laws, treaties, customs are gone.