Jeet Heer is baffled by Heinlein’s political evolution:

Heinlein went from being a left-wing New Dealer in the 1930s and 1940s to flirting with the John Birch Society in the late 1950s and supporting Barry Goldwater in the 1960s — and yet, he insisted that his politics were unwaveringly consistent. “From my point of view what has happed is not that I have moved to the right; it seems to me that both parties have moved steadily to the left,” Heinlein wrote his brother in 1964. Patterson, as was his wont on all major issues, sides with his subject and maintains that Heinlein’s politics remained fundamentally unchanged through his life. Heinlein was no “rightist,” Patterson assures us, but a lifelong “radical liberal” with a “democratic soul.” Patterson never explains how that “democratic soul” came to believe that the right to vote should be severely restricted, a position Heinlein advocated not just in Starship Troopers but also in nonfiction works.

[...]

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.

Heinlein had caught a bad case of the Cold War jitters in the late 1940s. He accused liberal Democratic friends, notably the director Fritz Lang, of being Stalinist stooges. With Heinlein’s great talent for extrapolation, every East-West standoff seemed like the end of the world. “I do not think we have better than an even chance of living, as a nation, through the next five years,” he wrote an editor in 1957. The USSR’s Sputnik launch in 1957 and Eisenhower’s moves toward a nuclear test ban the following year both unhinged Heinlein, who called Ike a “slimy faker.” By 1961 Heinlein concluded that even though it was a “fascist organization,” the John Birch Society was preferable to liberals and moderate conservatives.