"Here I'd get shot," he said during a Wednesday night press conference devoted primarily to his attempt to transform the American healthcare system.
Obama said that police acted "stupidly" in the arrest of prominent black scholar Henry Louis Gates Jr. and that despite racial progress blacks and Hispanics are still singled out unfairly for arrest.
"This still haunts us," Obama said.
Obama called Gates a friend, and said he doesn't know all the facts of the case. Nonetheless, Obama said, anyone would have been angry if treated the way Gates claims police in Cambridge, Mass., treated him. Gates claims he was arrested in his home after showing ID to police who responded to a report of a possible burglary.
Video: President Obama makes light to make a point about racial profiling during a July 22, 2009 press conference on healthcare reform.
"Cambridge police acted stupidly in arresting somebody when there was already proof he was in own home," Obama said during a prime-time news conference that otherwise focused on the health care debate.
Gates' arrest followed a report of a possible burglary. A woman apparently saw Gates force the front door and called police. Police came and demanded that Gates show identification. Gates was arrested shortly afterward for alleged disorderly conduct, a charge that was dropped Tuesday.
"What I think we know separate and apart from this incident is that there's a long history in this country of African-Americans and Latinos being stopped by law enforcement disproportionately," Obama said. "That's just a fact."
That disparity is a reminder that "race remains a factor in the society," Obama said.
The nation's first black president held himself up as testament to what he called the "incredible progress" minorities have achieved.
The police sergeant accused of racism after he arrested Gates insisted Wednesday that he won't apologize.
Police say Gates at first refused to display ID and then accused the officer of racism.
Sgt. James Crowley said he followed proper procedures in arresting Gates.
Standing in the stately East Room of the White House where he now lives, Obama allowed some humor into the discussion.
Obama ticked off the reported facts of the Gates case — starting with Gates apparently forgetting his keys and jimmying the door. Police responded appropriately at first, Obama said.
"I mean, if I was trying to jigger into ...," Obama began, and then trailed off as reporters laughed. Obama laughed, too. "Well, I guess this is my house, now so it probably wouldn't happen."
Obama said he could understand police responding in good faith if he was forcing his way into his old house in Chicago.
"Here I'd get shot," he joked.