I doubt there's much political gain in it for him: probably the opposite. It won't change minds, and it'll just further energize those who see in him an evil secret America-hating Muslim Nazi socialist communist Kenyan terrorist whose life was programmed before birth to come and destroy us. (How clever, his overlords, to foresee, at the height of racial strife, and while planning the rise of Islamic fundamentalism, that creating a mixed-race baby of a Muslim father would be just the ticket!) After all, who can forget the Rovian plan, successful plan, when George Bush was running, to get gay marriage issues on state ballots to increase the hater turnout. For hate is what motivates a critical mass of right wing voters, and this won't do anything to lessen it. (Similarly, the fact that Rominee bullied a gay student in prep school will likely raise the esteem in which he's held by homophobes. A person who was there at the time described Rominee's behavior as like "Lord of the Flies.") Nor do I think the votes of a few more gays, most of whom would be voting for him anyway -- notwithstanding his marriage waffling, he'd done far more for gay rights than any president -- would change election outcomes.
So I consider it a brave move, a moral one, and I applaud it. Still, there's something that bothers me. It seems that, although he made his views perfectly clear, he seems still to think that states have a right to decide.
Gay rights are civil rights. The only arguments against gay marriage and other rights are religious ones, based on a book full of contradictions on much more serious matters than marriage. Killing your kids, for one. To believe gays should be discriminated against, you have to believe that homosexuality is a choice, and that it's religiously prohibited. The first is clearly scientifically wrong (what??? You mean right-wingers reject facts to maintain their deep-seated prejudices and belief in pre-failed policies??); the second has no business in civil law. If you believe in the Constitution (you know, like all those teabaggers) then you can't reconcile the idea of states voting away the civil rights of a class of citizens based on sexual preference any more than you can do so based on skin color. Or gender. And, yes, I'm well aware that there are plenty of right-wingers who'd happily do both.
In making his stand, I don't see much upside for President Obama, other than easing his conscience. And I wouldn't be surprised if it was Michele who finally got him to do it. But whereas he made a gutsy move, he's still not quite all the way there.