How did people manage to travel to other countries before there were passports???
Countries didn’t use to exclude non-citizens. Most of the world’s population was immobile. And countries wanted to attract immigrants, not shut them out.
walking, or by ship
The modern passport didn't exist until after World War 1. Before that, governments sometimes did issue documents called passports, but it was usually a sheet of paper that was more like a letter of invitation or introduction that included a physical description or even a drawing of the traveler before photography. However, they were not universal and the cliche until WW1 was that one could "travel the world (as a tourist) with only a calling card" and of course lots of money. There is a Wikipedia article: https://en.wikipedia.org/wiki/Passport#History