In the modern age, it is normal that (groups of) countries require passports and possibly visas for visitors from other (groups of) countries. In the past, many people from Europe migrated to North America and other parts of the world. According to Wikipedia on the history of passports, In the later part of the nineteenth century and up to World War I, passports were not required, on the whole, for travel within Europe, and crossing a border was a relatively straightforward procedure. It continues to describe how During World War I, European governments introduced border passport requirements for security reasons, and to control the emigration of people with useful skills (sounds like an exit visa).
When did government authorities start to enforce generic limitations on who could settle in the area under their control? And when did they start to enforce such limitations on who could travel, for either business or leisure purposes? Was World War I the first time either of those were enforced? For example, were there limitations either way on transatlantic travellers in the 19th century, whether for a temporary visit or for permanent settlement?
By generic limitations, I mean limitations that apply by default to everybody, such as requirement to have a passport with a visa to travel, or a work permit or other kind of visa to settle. I do not mean specific rulings such as exile that are targeted at particular individuals.