Nope, he was definitely for it. That link goes to 2004... by that time he was considering running for president and at that time presidents of the U.S. just didn't go around supporting gay marriage. He had to say he was against it because that's what was expected of him at the time. So, I guess he basically lied...
I think they made that little back story up about it being a part of his religious beliefs because they wanted to distance him away from any Islamic ties that he had. Saying he was against sam sex marriage because of his deep belief in Christianity was enough to help him in the "looking like a good 'ole Christian" department (as well as some other things they did (I remember them showing him and his family at church and all that).
Anyway...in 1996, he said he was in support of it.
Obama Once Supported Same-Sex Marriage 'Unequivocally'
From the article: