The Democratic senator's appearance at the Saddleback megachurch was a source of dispute among evangelical leaders, with some of the most conservative saying that a politician who supports abortion rights should not have been allowed to speak at such a prominent church.
Obama urged unity despite political differences to fight the disease that has killed 25 million people since the first case was reported in 1981. Some 40 million currently are infected with HIV, the virus that causes AIDS.
"We are all sick because of AIDS," Obama said. "We are all challenged by this crisis."
In a show of political unity, Obama took an AIDS test with a potential White House rival on the Republican side — Sen. Sam Brownback of Kansas. Brownback draws his support from the conservative evangelical community, but Obama has been urging liberals not to allow Republicans to claim itself the party of Christians.
After addressing Brownback as his friend and applauding his efforts on issues such as AIDS, Obama said: "There is one thing I've got to say, Sam, though: This is my house too. This is God's house. So I just want to be clear."
In another show of bipartisanship, the Illinois senator said President George W. Bush does not get enough credit for committing $15 million against HIV and AIDS over five years.
He called the dispute over condoms a "false argument."
"I also believe we can't ignore the fact that abstinence and fidelity, although the ideal, may not always be the reality, that we're dealing with flesh and blood, men and women, and not abstractions, and that if condoms and potentially things like microbicides can prevent millions of deaths, then they should be made more widely available," Obama said. "That's my belief."
He said men and women often are "contracting HIV because sex was no longer part of a sacred covenant, but a mechanical physical act." He said government programs cannot solve that problem, but churches can make a real difference by providing people with a moral framework to make better choices.
"I don't care whether you're conservative or liberal, you've got to lift up that aspect of this struggle," said Obama, who at times drew applause.
Obama repeated a story that he read in the Chicago Tribune about a South African woman named Hlengiwe Leocardia Mchunu who lost five of her seven siblings to AIDS. He said he could not imagine what it would be like to have AIDS affect his family, but "here's the thing — my faith tells me that Leo's family is my family."
The summit came on World AIDS Day and the 25th anniversary of the discovery of the disease.