Germany and Austria have been fighting about whether Mozart was German or Austrian. The whole thing is really silly, of course. Mozart was born in Salzburg, which is currently in Austria, but was sem-independent at the time and part of the Holy Roman Empire, which was in many ways the forebear of Germany. Mozart thought of himself as a German and Austrian.
The point is of course that there was that in the 18th century, there was no contradiction in that. The nation state had not been invented. Being German meant to be from German roots, speaking German etc. Being Austrian meant being a subject to the Austrian emperror.
Only in 19th and 20th century became the idea popular that people of the same nation (i.e. language, culture and ethnicity) should be in the same state. Nationalism as binding ingredient of a political movement proved very effective, of course and shaped the world as we know it. Still, it is interesting to look back at the world before the nation state.
Borders between states used to be bounderies of political influence. One could travel from one country to another, hardly being bothered by the autorities. Before the First World War, passports were letters of recommendation. A passport was the request of a souvereign to treat the bearer with respect. Indeed, before 1858, the British king or queen issued passports to foreigners and British alike. Roma could travel where ever thay liked. If one country was richer and had a shortage of labourers, people would just come there to work.
Maybe the modern societies with their complexities demand the the new restrictions. Operating a social security system without them might be tricky. But the freedom and flexibility lost hurts us and the poor the most.