A review in the New Republic of volume two of the authorized biography of Robert A Heinlein takes the biographer, William H Patterson, to task for his uncritical approach to Heinlein's famously all-over-the-place politics. But there is enough (uncritical) details in the book that the reviewer feels able to parse out Heinlein's swing from socialist to right-wing libertarian (here's my review of part one).
Heinlein's leftwing politics got him blacklisted from the Navy, which didn't want his services even during World War II when the military was so desperate for trained recruits that they found office jobs for disabled soldiers. Instead he worked as a civilian engineer in Philadelphia, helping to design the high-altitude pressure suit, a precursor to the astronaut suit. In 1944, Heinlein met Lieutenant Virginia Gerstenfeld, and after the war tried to bring her into his house as part of a ménage à trios. Gerstenfeld accepted but her stay with the Heinlein's was brief and stormy. This wasn't the first love triangle in the Heinlein residence (they had earlier been in a consensual threesome with L. Ron Hubbard), but Leslyn found Virginia threatening so the marriage collapsed in 1947. Heinlein and Gerstenfeld wed the following year, a marriage that would also be open.
Whereas Leslyn was a liberal Democrat, Virginia was a conservative Republican. Some of Heinlein's friends speculated that his shift in politics was connected to his divorce and remarriage. That's too simplistic an explanation, but Heinlein acknowledged that Virginia helped "re-educate" him on economics.
In truth, Heinlein's shift to the right took place over a decade, from 1948 to 1957. In the early 1950s, the Heinleins travelled around the world. The writer was already a Malthusian and a eugenicist, but the trip greatly exacerbated his demographic despair and xenophobia. "The real problem of the Far East is not that so many of them are communists, but simply that there are so many of them," he wrote in a 1954 travel book (posthumously published in 1992). Even space travel, Heinlein concluded, wouldn't be able to open enough room to get rid of "them." Heinlein treated overpopulation as a personal affront.
A Famous Science Fiction Writer's Descent Into Libertarian Madness [Jeet Heer/New Republic]
Heinlein memoir: LEARNING CURVE – the secret history of science fiction [Review of book one]