Earlier quoted context omitted.
But visa-free travel is not the same as visa-free emigration. Very, very few countries let people from other countries just buy a house or setup shop (pretty much just the Schengen zone).
Were there actually legal restrictions on those things in many places prior to the routinization of passports and passport controls in World War I?
the US started restrictions (at the time by race) with the Chinese Exclusion Act of 1882.
Australia and New Zealand had their own versions of the above in place somewhere between the 1880s that and the 1920s.
Latin America also attracted a lot of immigrants so I assume not that many restrictions but I don't know what laws were in place. You'd have to check country by country.
I assume colonial powers didn't restrict their own countrymen from emigrating to their colonies in Africa or Asia but that's just a guess.
I believe the above covers most of the large scale immigration at the time. To be honest I don't know what would happen if say a random Frenchman went to Tokyo/Moscow/Beirut and tried to buy a house, get a job and marry a local but that's an interesting question.
Unfortunately the general wikipedia page isn't complete: https://en.wikipedia.org/wiki/Immigration_law