Politico explains that it was Biden's snafu on Sunday, and the White House Press Corps subsequently eating White House spokesman Jay Carney for lunch, that spurred the President to act now:
In the end, people close to the president say, it wasn’t a close call: The core of their argument against Mitt Romney is that he is an untrustworthy politician with no real core of conviction. Obama’s advisers — who are acutely conscious of the media’s criticism despite their professed contempt for the news cycle — simply couldn’t afford to have the president appear like a coward on the front and editorial pages of The New York Times and The Washington Post, according to senior Democrats.I have to give the White House Press Corps credit for doing an incredible job on this issue over the last few days, but really over the last year and then some. They dogged this tenaciously.
If Biden’s comments were the catalyst for Wednesday’s historic announcement, Jay Carney was the immediate trigger, officials said. The White House press secretary took a serious drubbing on Monday when reporters all but accused the White House of cowardice on the issue.
AP's Charles Babington says that Obama's move poses a risk for Republicans as well:
Public opinion about gay marriage has changed so rapidly that President Barack Obama's historic embrace of it may pose as many political risks to Republicans as to the president and his fellow Democrats.
The president's dramatic shift on the issue - a watershed moment in U.S. politics, even if many people felt it was inevitable - is the latest sign that Democratic hopes increasingly rest on younger, college-educated and largely urban voters, whose lifestyles are shaped by social mobility more than religious and community traditions. Many young adults find the notion of discriminating against gays and lesbians as incomprehensible as their parents' and grandparents' accounts of living through racial segregation.