Before Gerard O'Neill began designing space habitats, Dandridge Cole designed similar "bubble worlds". I have imagined that similar structure could become havens for endangered species.
A similar habitat-"Hiawatha"-appeared in Poul Anderson's Psoletechnic League/Terran Empire space opera. However, hyperdrive permitted access to Earth like planets, and it was easier to colonize these planets than to build habitats. I think that a similar scenario applied to Star Trek, with warp drive permitting colonization of those class M planets that were within reach.
However, in the novels some of these planets were attacked and rendered desolate by the Borg. Riker came across a planet that was clearly terraformed, so there was the idea of finding the terraforming technology, and using it to heal the devastated planets.
Of course, there is the idea that an asteroid might be hollowed out by mining operations, and later turned into a habitat. I'm thinking that there might be many of these in different solar systems, and might be quickly turned into habitats with minimal investment. Somewhat similar to the "drifts" in the Adromeda series.
With the sort of technology used in starships, it may not be necessary to build an Cole/O'Neill type habitat-essentially a pressurized centrifuge.
And if one has the opportunity to set up one's own community, different groups of refugees might reject political compromise and create communities based on their own philosophies, religions, ideologies, ethnicities, etc. A somewhat similar scenario played out in the original 13 colonies of the American east coast. And then there were the Mormons in Utah.