Yes, voicing his support was a calculated move done to help increase his support among his base, which is not the religious, middle-of-the-road, conservative voters, but his young and left-wing voters. Polls say that he has lost some support among these voters and that his strategists are having him focus on "symbolic" issues to win them over that won't call for him having to actually create any legislation.
From here: https://www.commondreams.org/view/2012/04/18-7
I do think it would be abominable for a president not to voice support for marriage equality or to support but remain silent about it. However, he's not going to do anything about this. It's actually rather safe for him to say he supports this as it's an issue decided on the state level, not one under his jurisdiction anyway.