One of the ways that the Tokugawa shogunate kept Japan peaceful was through Sakoku. This closed the country off to foreign trade, and travel. Japanese citizens were also unable to leave, with few exceptions.

Certain groups were allowed to interact with Japan though, specifically Chinese, Korean, and Dutch merchants. Foreigners were not allowed on the mainland though, they had to stay on a small artifical island called Dejima.

(Titsingh, "Ground-plan")

In order to leave, Japanese people would need a special license. If they did not have one, and tried to return to Japan, they would be executed ("Sakoku").