In English and derived legal systems. Or any other if relevant. To me it seems like such a bizarre thing, as it seems like most of the people who make laws (i.e. wealthy land owners) would be against it. Have attitudes to squatters changed in recent years? I know English land law can be pretty damn complicated so what I'm wondering is mostly to do with attitudes as opposed to legal specifics.
I can't give you too much detail of the legal specifics, but I can explain why such a thing was tolerated. It might also be a good idea to look at the concept first legally and then politically.
The main reason for the advent of what we call "squatters' rights", or what is more properly called 'adverse possession', is that up until the 20th Century, discovering what is called the 'root of title' could be very difficult indeed.
A lot of transactions in land were not formalised, and even when they were, finding out true ownership of land/property rights involved a process of tracing from one deed to the next, perhaps back hundreds of years, how ownership had passed. In this context it was not always easy to say that just because someone had no title deeds it meant they did not have rights over the land. Land might be technically owned by a large landowner who had nothing to do with it and made no use of it; it made little sense to kick someone off land that nothing was being done with. Perhaps the most important reason for adverse possession being recognised is that someone might have title deeds, but these did not always accurately describe the actual land that the title attached to - someone might have used one part of their land to graze sheep for many years, but it might turn out that a new person buys the title to neighbouring land and discovers that this was actually part of their land.*
It was because of these difficulties the previous common law developed to protect land users rather than putative landowners. The rule was that if you could prove continuous occupation for 12 years, then you might be able to claim title to the land.
This of course, could not continue; as the 19th and 20th Centuries wore on, the old system simply was not viable in an age when land use intensified and more and more people began to buy and sell property. Beginning with the Land Registration Act 1925, land in England and Wales began to be registered in a database of land ownership which shows both who owns the title and gives illustrative (but not definitive) maps of what land the title attaches to. This process continued slowly until 2002, when the Land Registration Act 2002 changed the law so that most land now must be registered, and it also changed the law of adverse possession. Now (if the land is registered) you may apply to be recognised after 10 years of actual physical possession of the land, as having title - but the Land Registry will notify the current owner and they may object.
In essence, there are no longer the same sort of squatters' rights as there once were, as they stemmed from a time of much less formality in property use, and in 2012 squatting on another's land was made a criminal offence.
Squatters rights has also been a very political issue. I don't know as much about this, but the question of land use has been a big one in populist politics for many years, playing a part in both the Peasants' Revolt and the actions of some radical groups, such as the Diggers in the English Civil War.
This was more about the question of ownership of land in a political sense; the enclosure of common land picked up pace in the 16th and 17th Centuries*. Where land use had previously been based on traditional rights in common to graze animals etc., England was changing to a country where land use was largely a private affair, where property rights were purely a question of ownership, and not of tradition. This also linked with some of the legal questions surrounding adverse possession; people might continue to use land that had been legally enclosed even though they believed their cottage had ancestral rights to graze cattle on certain land - this led to many court cases about who had the right to use the land. People like the Diggers felt this was wrong and squatted on unused land, trying to turn it back into communal spaces.
From then on "squatting" has come to acquire a very political meaning - the idea that the land belongs to all of us, and if you aren't making use of it then people in need should be able to take occupation of it. It is associated heavily with collectivist and communal ideas of property, but most of the time what is done is not legal, even if there are situations in which property rights can be acquired by the fact of occupation.
Needless to say this is never really been the position of the law (much as many squatters might think otherwise), though the courts have always noted that land is a precious resource and should not be wasted, and look favourably upon those who occupy and improve land.
In Britain it came out of Common Land rights won through various struggles throughout english history, it is estimated that 50%+ of British property today is of squatting. The making of squatting illegal recently in the UK reverses over 1000 years of Common Law.
Squatting is merely an expresses of human tendencies, that to occupy what other don't already occupy, it's a basic human movement which has been curbed since the rise of bourgeoisie property and states committed to defending it, since then squatters rights have been curbed if not outlawed completely, but that human tendency (i.e. homeless people and people-less homes) is impossible to deny whilst ignoring it's causes, as such many large squatters movements exist today, with all major cities on earth having squats.