In an interview, he said: "As has been well documented, I smoked pot as a kid and I view it as a bad habit and a vice, not very different from the cigarettes I smoked as a young person up through a big chunk of my adult life."
Mr Obama added: "I don't think it is more dangerous than alcohol."
Smoking marijuana was "not something I encourage, and I've told my daughters I think it's a bad idea, not very healthy", Mr Obama said.
His government has given states permission to experiment with marijuana regulation and laws recently passed in Washington state and Colorado legalising marijuana recently went into effect.
The president said it was important for the legalisation of marijuana to go forward in those states to avoid a situation in which only a few are punished while a large portion of people have broken the law at one time or another.
Speaking to The New Yorker magazine, he said he was troubled at the disproportionate number of arrests and imprisonments of minorities for marijuana use, saying: "Middle-class kids don't get locked up for smoking pot and poor kids do."