In an interview Wednesday with ABC News, Obama said his thoughts about gay marriage evolved during conversations with his friends and family.
"I have to tell you that over the course of several years as I have talked to friends and family and neighbors, when I think about members of my own staff who are in incredibly committed monogamous relationships, same-sex relationships, who are raising kids together, when I think about those soldiers or airmen or Marines or sailors who are out there fighting on my behalf and yet feel constrained, even now that don't-ask-don't-tell is gone, because they are not able to commit themselves in a marriage, at a certain point I've just concluded that for me personally it is important for me to go ahead and affirm that I think same-sex couples should be able to get married," Obama said.
The interview is scheduled to air Thursday on "Good Morning America," ABC News said.
The president had previously voiced support for civil unions for gay and lesbian couples but had opposed defining it as "marriage."
Republican Mitt Romney, Obama's likely opponent in the November general election, declined to comment on the president's endorsement of gay marriage, The Hill reported.
Romney, however, reiterated his opposition to same-sex marriage during an interview with KDVR-TV, Denver, as a bill that would have allowed civil unions for same-sex couples died in the Colorado Legislature Tuesday night.
"Well, when these issues were raised in my state of Massachusetts, I indicated my view, which is I do not favor marriage between people of the same gender, and I do not favor civil unions if they are identical to marriage other than by name," Romney told KDVR.
"My view is the domestic partnership benefits, hospital visitation rights, and the like are appropriate but that the others are not."
Housing Secretary Shaun Donovan has previously expressed support for same-sex marriage.
Obama said during his 2008 campaign for president he backed civil unions but not marriage for gay couples and has since said his position on the issue was "evolving."