The outer space treaty, which all space faring nations have signed, specifically forbids nation states claiming territory in space. And that includes all their citizens.
And the thing is - that this is the only space treaty we have essentially. It's a remarkable achievement as it is really hard to get everyone to agree to a treaty. As was discovered when they tried to pass the Moon treaty which only a few have signed. And it's the only treaty for instance to prevent countries from establishing military bases on the Moon or putting nuclear weapons into LEO. And as for amending it, well it's the same problem - how do you get all those countries to agree to an amendment. So I think we are going to stay within the provisions of the OST and find a way to work around it and add to it rather than change it. And to withdraw from it would be a huge signal to other nations, saying you no longer agree to peaceful exploitation of space, can't see anyone doing that.
Now there's nothing to stop anyone, you or me, saying "I claim the Moon" or "I claim the Mars". Indeed there have been people historically who have laid claim to the Moon, even to the Sun. But without a government to uphold their claim it's an empty claim.
Presumably if at any time there were millions of people living on the Moon or on Mars or in free space, something would change there. But it's possible to have a sort of claim without needing to own any space bodies.
Because - they are of little use as "real estate". You can't do anything with the Moon or with Mars unless you build habitats there. And you do own your habitats in the Outer Space Treaty - at least - so long as you don't abandon them.
So - could just run with that, and say - okay you own your habitat, because you built it and you own things you build. You own any gardens you make by covering over areas of the Moon with greenhouses. But you don't own the ground they are built on just the greenhouses themselves. And is reasonable to have a safety region around your habitat e.g. if anyone comes to visit you, you would guide how they land their rocket so that they don't risk damaging your habitat or gardens.
All that seems reasonable and consistent with the OST if not actually covered by it. (It does explicitly say though that you own your habitats - but a bit awkward - it says that anyone else can take your habitat and return it to Earth so long as they give it back to you, so that I think would need a bit of clarification and extra rules :) ).
In any case, I can't see millions of people living on the Moon or Mars or anywhere else in the near future. After all we have much more habitable places on Earth such as the ocean floor of the shallow continental shelves (far far more habitable than anywhere else in the solar system) or Antarctica, or our deserts, or we could have cities floating in the sea, even cities also floating in the upper atmosphere (Buckminster Fuller figured out that a large kilometer sized sphere would be warm enough to float just through its internal heat through human activities and easily strong enough, if built like a geodesic sphere, to withstand anything the weather would throw at it) - all that would cost much less than a Mars or Lunar colony.
So - I think a future with millions of people in space colonies is also a future with millions of people living on the sea bed, and in floating cities in the sky, and big self sufficient cities covering all the deserts and mountain tops on the Earth. Only after that would we begin to run out of real estate to the extent where it would make sense to build a space colony.
Other than that they are all tourists or scientists or adventurers who are in space for the fun or adventure or for knowledge etc - but not because they hope to find somewhere that is as good to live in as Earth.
Even after a 1000 years of terraforming, even if it all worked perfectly, Mars would be nowhere near as hospitable as Earth - even not nearly as hospitable as Earth immediately after a giant impact by the largest ever meteorites to hit Earth since the late heavy bombardment over 3 billion years ago.
So I think too early to worry about the politics of colonies, not likely to happen.
What could happen though - politics of resources in space. So - then the question is - what resources might be precious? Well metals from asteroids, say platinum. There is loads of it up there - but some asteroids easier to get to than others, so easier to export the materials to Earth. Same also for ice, for supplying water to LEO or to space colonies.
So, might get nations or companies trying to assert some control over such resources. Hard to do that legally as they have also all signed the Outer Space Treaty that they are exploring in space for the benefit of all humanity. On the other hand then obviously those who mine in space need to be able to make some profit to pay for what they are doing. Is possible to make it consistent with the treaty with some form of "functional ownership" and various other ideas, such as control of a safety region around your mine. But legal status of any materials returned - if someone sells you some platinum they mined from an asteroid - is it really theirs to sell to you? Given that nobody owns anything in space?
The Americans and Russians do own the moon rocks they returned from space - but arguably they do that in a way that is consistent with the idea that they returned them for the benefit of all of humanity - permitting scientists of all nations to study them. It might get more tricky for things such as returned platinum or ice mining.
I see that as likely to be the most contentious area of space politics at least in the near future.