He is a politician. That is what they do, plan/play politics. Anyone who thinks any politician, Democrat, Republican, or other (with some rare exceptions, usually falling in the "other" category) make reasonable stands based on their personal convictions is naive at best, a complete dupe at worst. There are some that make a stand on personal convictions in a way that is completely irrational, and not going to be a good candidate for actually caring about the interests of all the people they represent, or even most of them, because most of them are of the idea that they were elected because every single person that voted for them agrees with absolutely everything they have said or done. Doing this then makes them an idiot or just crazy (some specific politicians come to mind for this one).
Change happens. The "left" saw the direction the wind was shifting when it came to gay rights. Heck, so did the right, hence DOMA. Even then, those my age supported same sex marriage in higher numbers than our parents, despite being in high school. Some did this because of peer influence (we had a pretty openly gay guy in my high school that was pretty respected, even in a western-NC high school (we were still having issues with people not approving of interracial relationships, which ironically enough the guy who was gay was mixed race, raised by his white grandparents)). Heck, it was the 1990s sitcoms that introduced many of those my age to the concept of not just gay marriage, but even different family types, especially for those raised in nuclear families (which actually wasn't me). The first same sex wedding on US TV was in 1991, on "Roc". We had three men raising three little girls on "Full House", even claiming in either the 2nd or 3rd episode to each be Stephanie's father. Both Roseanne and Friends had same sex weddings in the mid-90s. And Roseanne had at least two regular gay characters (and wasn't the sister bisexual?).