Prior to Obama's announcement, Electionate broke down the politics:

[G]ay marriage’s real problem is that Obama is unlikely to win any new adherents by switching his position. Are there impassioned supporters of gay marriage who would choose to oppose a liberal President, let alone support a conservative Republican nominee, if Obama doesn’t switch his position? Anyone serious enough about gay marriage to vote on it has already aligned with the Democrats.

Harry Enten differs slightly:

The truth is that when you look at the numbers, there just really isn't anything to suggest that support for gay marriage would be a "killer" electoral liability for Obama. In general, Americans simply don't vote on it as a single issue, and the edges of Obama's coalition are unlikely to be trimmed because he voices support for it.

How Douthat explained Obama's former caution:

[O]pinion polling has consistently understated opposition to same-sex marriage since the issue rose to national prominence. Voters who say they support it when Gallup and other pollsters come calling can behave very differently in the privacy of the voting booth.

Among John Sides's questions on electoral consequences:

What percentage of people really make the decision about whether to vote based on the candidates’ positions on a single issue?  And what percentage of voters are truly persuadable in terms of the candidate they support?  Why would these voters make a decision about whom to vote based on Obama’s position on gay marriage?  Are these “marginal” voters the kinds of people who are likely to follow the news closely enough to know Obama’s position?