In the 19th Century? Easy as pie.
There were essentially no travel restrictions across national borders until the First World War. You went somewhere, settled, maybe report your existence at the local police station, and that's that. There was basically no controls until the outbreak of the war. At certain ports (e.g. Ellis island) you might checked for disease, but otherwise came and went as you pleased.
WWI really changed everything. Travel restrictions, IDs, passports, centralized records and bureaucrats were introduced everywhere. There is a beautiful heart-breaking story by Stefan Zweig - "Buchmendel" - about a Russian-born Jewish book dealer in Vienna who got caught up by the outbreak of WWI that plays on this theme.
In the Medieval & Early Modern era, there were lots of controls on internal movement, esp. of the poor, e.g. in-passports needed to enter Paris, out-passports to leave a village or county. But these were locally obtainable on the spot or largely unenforced (the usual "travel restriction" was just to shut the town gates at night). People caught begging were of course were "moved along" by the local magistrates (often after a whipping). Those who requested charity from the parish church (or looked so poor that they were suspected to have that intention) could be reported to the police and be checked if they were natives of the parish or of a "foreign" parish (no documents produced, their names were just checked against in the local church's birth registers). (In pre-modern era, the term "foreigner" meant a person from another parish; a "stranger" was a person from another country; today it is more the reverse).
More serious was an indentured servant, serf or slave, or something like that. He would need to carry around a document proving permission from the master.
Pre-Modern controls between countries were rarer, and often pertained more to preventing your own people from leaving (vid. Louis XVI at Varennes), than the other way around.