Most of the novel is set on the moon's prison colony. Due to the smaller gravitational pull, people who spend more than a few months on the moon will be unable to return to Earth. Thus, any prison sentence is essentially a life sentence of exile. Anyone born on the moon, similarly, will not be able to travel to Earth.
The sex ratio is approximately 2 males to 1 female. I suspect the skewed ratio is intended to reflect the real discrepancy in the prison population. Curiously, this gives women incredible power since the society is essentially egalitarian. Women may have multiple husbands. However, line marriages are preferred. A line marriage includes several generations of husbands and wives. New spouses are added slowly over time, voted in by the entire family. The eldest, particularly the eldest female, are the leaders of the family. Line marriages offer extra security in an unstable environment: the family continues even when a spouse dies; children can depend upon multiple parents; the family benefits from multiple incomes; a large families will have a variety of skill sets in its members; old families can benefit greatly by the work done by predecessors. Geez, this is starting to sound more and more appealing all the time. Did I mention that rape is practically unheard of and considered one of the worst crimes possible? Even sexual harassment is rare. Oh yeah, and most property is in the name of a woman. And while murder is rare, a murderer is expected (maybe even forced) to pay of the deceased debts and care for his family. Divorce is pretty rare. A person can just walk away from a family at any time but divorce is hard. All the women of a family must vote to divorce a man, no information about how a woman is divorced. Children born in to a family can elect to become part of the marraige when they are of age, strongly implying that while all spouses are considered spouses, they are not all sexual relationships since this would lead to incest. Race is also a non-issue on the moon (though the Earth still clings to its antiquated racist notions).
The economy and life-support systems are controlled by a computer, called Holmes. The computer develops self-awareness and a strange sense of humour. S/he also develops a plan to free the moon of Earth's control, which is heading the moon toward a catastrophic collapse and eventual doom for every Lunar citizen. After the rape of a lunar woman by terrestrial soldiers, the revolution is on, manipulated carefully by Holmes. Somehow the sentience of Holmes is less interesting than the sexual politics of Luna. Holmes was my favorite character, it was amusing to hear of his practical jokes, satisfying to watch his political manipulations, sad when his sentience died. But compared to the sexual and racial equality, it is just not that interesting.
Heinlein also uses the book as a platform against popular vote democracy as mob rule. You can take that how you want to since I have no experience with real democracy. Actually, coming from California, I have had some experience with the negatives of full democracy since anyone can nominate any bill to be voted on by the whole state. That has sunk California deeply since people are constantly voting for expensive public works to be paid off in bonds no one is buying. I am okay with representative democracy, but the electoral collage system needs to go.