In an interview for comedian Marc Maron's WTF podcast in America, Mr Obama said that although attitudes about race have improved since he was born, the legacy of slavery was "still part of our DNA".
"Racism, we are not cured of it. And it's not just a matter of it not being polite to say n***** in public," he said.
"That's not the measure of whether racism still exists or not. It's not just a matter of overt discrimination.
"Societies don't, overnight, completely erase everything that happened 200 to 300 years prior."
Mr Obama will travel to Charleston on Friday to deliver a eulogy at the funeral of one of the shooting victims, Rev Clementa Pinckney.
On Friday, 21-year-old Dylann Roof was charged with the murder of nine people at the Emanuel Africa American Episcopal Church in Charleston.
A racist manifesto apparently written by Roof along with a series of photographs of him posing with guns emerged last week.
During the interview, which was released on Monday, the President expressed frustration with the National Rifle Association's (NRA) grip on Congress and the lack of movement on increased gun controls.
He said: "I will tell you, right after Sandy Hook, Newtown, when 20 six-year-olds are gunned down, and Congress literally does nothing - yes, that's the closest I came to feeling disgusted. I was pretty disgusted.
"The question is just: is there a way of accommodating that legitimate set of traditions with some common sense stuff that prevents a 21-year-old who is angry about something or confused about something or is racist or is deranged from going into a gun store.
"That is not something that we have ever fully come to terms with."
Mr Obama pushed for gun law reform after the 2012 Sandy Hook massacre.
He proposed more background checks for gun sales, a ban on military-style assault weapons and a limit on ammunition magazine capacity, but he ran up against a legislative roadblock.
During the podcast, Mr Obama added: "I don't foresee any legislative action being taken in this Congress.
"And I don't foresee any real action being taken until the American public feels a sufficient sense of urgency and they say to themselves, 'this is not normal, this is something that we can change, and we're going to change it'."