This is a question from my 8yo daughter. During medieval times, if an area had a ruler that was taxing too much or had bad laws - would people living there be able to leave? Would there be any mechanisms for stopping people from moving to a different area, or from immigrating inside? Now that I think about - what did immigration look like? I guess we are mostly interested in Europe, but other areas may be interesting to hear about as well. As a followup from Dad: What would crossing a border look like for a merchant or a commoner? Were permits required? Was there a guard post?
I answered to the best of my ability (basically - too expensive for most, may have been tied to land).
There were different laws and customs in every regions of Western Europe at the time. However, here is how you can explain things to your 8 years old daughter :-) I tried to lay it out as simply as possible.
One thing that is true of the Middle Ages is that equality among people wasn't even a concept and even less of a fact. Social hierarchy was paramount. However, we have many examples of people trying to break out from it. The system put in place just didn't work and couldn't last. Eventually it collapsed as history showed.
The medieval era moved on from a period of landowners who relied on slaves as a workforce to plough their fields. Free men were scarce. However, the early troubles that accompanied the end of the Western Roman Empire and more unsettling grand events in more recent centuries helped the "little people" to break from their former shackles. Slaves became serfs, which granted more lee-way and rights. However, they were still explicitly forbidden to leave their lord's domain.
If serfs were caught trying to escape from their lord's land they'd be punished for it. They were considered as belongings. They could be borrowed or bought. They only had a few days for themselves each week to work their own field. Otherwise they were called on by their lord to work his field or they had to respect rest days and attend church celebrations (they were so many "holidays" by the end of the 15th century that people actively fought to get the right to work by the Early Modern Era).
Nevertheless, serfs did try to escape from their condition or to improve it. We have a few charters explicitly ruling that any serf that had lived within a town for a year and a day were freed from their former ties to their lords and couldn't be pursued anymore. This started to happen more and more by the 11th century.
When they couldn't escape individually and seek out a better life in a nearby city, serfs united, put their money together and straight out attempted to buy their own freedom. Revolts could happen but they were more scarce than we'd like to believe. More often than not, diplomacy was favoured in the Middle Ages (or we wouldn't have so many charters to decypher!). There were, of course, a few revolts but they weren't the rule and they almost always ended badly for the rebels.
They didn't only belonged to lay lords, but also to ecclesiastic congregations. The "lord" could be an abbot or a party of canons. I just wanted to remind that fact :-)
Normandy stood out as one of the few French duchies were there were no serfs, as early as the 11th century. Nevertheless, peasants in precarious economic situations didn't roam the land freely for there were great risks from leaving your community and your support system (unless you went away briefly on a pilgrimage, which was a well-established and insitutionalized kind of peregrination). People in the Middle Ages relied heavily on their community and had closer ties to their neighbours and relatives than we have today. Leaving a land because of an unfair lord even if you were free to do it came a great cost!
During the Hundred Years' War and when there was two kings for a single throne (Charles VII and Henry VI), some people moved out as armies marched on cities and took them. Out of such ordeals we have kepts a few letters of pardon. People who fled Rouen or Paris and then tried to move back in before the city was taken back had to ask a formal letter of pardon to move back in. This is a very specific example but it leads to show you how little freedom of movement people could enjoy. You couldn't travel on a whim nor move out to another city without a concrete plan and the back up of the authorities.
What about trade? Merchants did roam the land but they had to request "laissez-passer" to cross a lord's land safely. The count of Champagne was famous for such letters during the 12th and 13th century, at the height of the Champagne fair. Not only would he allow merchants on his land but he'd also ensure their safety military wise. He understood how much money was to be made out of international fairs and he worked his best to turn them into a regular opportunity for merchants to come into his county and commerce there.
Lords did build fortified bridges to facilitate the passage or access to their lands, mostly around the 14th century. However, every road taken or any bridge crossed came with a tax. Therefore merchants, instead of travelling from Spain to England or beyond, for example, mostly specialized in shorter back-and-forth trips where they had good working relations. They were also often forced to stop and sell their goods in a few cities (this is what we call "staple privileges", talked about in a previous contribution of mine).
Overall, social and economic mobility was decided by lords though we have to consider the preexisting constraints of a peasant's living condition first. Lords could encourage mobility (and they did it a lot in the 12th and 13th century, founding cities and freeing serfs left and right to boost trade on their land) but they could also opt out for a more conservative approach.
Serfs and free peasants didn't always abide to the rule of their lords. They often collectively tried to sweeten it with a deal or they revolted in the worst case scenario. A few people just fled the land they were tied to but they had to renounce their community and forego their supportive system while doing so.
Pilgrimages were very frequent, though, and the medieval society was far more mobile than we tend to believe at first glance. Nevertheless mobility remained a privilege more than a common and universal right. Not every body could travel as far and wide as Albert the Great, a well respected bishop and man of the Church.
Here's a handy phrase for your daughter to learn: "City air sets you free after a year and a day". More can always be said from anyone with the expertise, so don't let this post stop you from writing up anything if you want to put your own oar in!
For the meantime, here are some previous posts that address you and your daughter's concerns: