The 17-year-old was shot dead by a neighbourhood watch volunteer, George Zimmerman, 28, on 26 February.
Nearly a month after Trayvon’s death, no arrests have been made, despite George Zimmerman admitting to the killing, saying he did so in self-defence.
Mr Obama called the shooting a “tragedy” that should touch every parent in America and said it made him think of his two young daughters, Malia and Sasha.
He said: “My main message is to the parents of Trayvon Martin. You know, if I had a son, he’d look like Trayvon. I think they are right to expect that all of us as Americans are going to take this with the seriousness it deserves and that we are going to get to the bottom of exactly what happened.”
He added: “I think all of us have to do some soul-searching to investigate how something like this happened. And that means we examine the laws, the context, what happened, as well as the specifics of the incident.”
Mr Obama’s comments came as around 8,000 people attended a rally in Sanford to demand justice for Trayvon.
Although the teenager was killed just under a month ago, publication of 911 calls and testimonies have provoked anger over his death.
The Florida police chief in charge of the investigation, Bill Lee, has stepped down from his post “temporarily”.
The announcement came after a vote of no confidence in the Sanford police department by the city commission.
Speaking to Channel 4 News Washington Correspondent Matt Frei on Thursday, Trayvon’s parents, Tracy Martin and Sybrina Fulton, spoke of their confidence that their family would “get justice”.
“It still hurts deeply, we’re still grieving and we still haven’t got over it. It’s still a nightmare for us. We still need answers from the Sanford police department, [which] we haven’t gotten,” said Ms Fulton.
“I’m very angry but I find comfort in knowing that Zimmerman will be arrested and we will have justice for my family.”
She added: “[Trayvon] was just an average teenager. He loved to play video games and listen to music and talk on the phone.”