After launching his candidacy as an outsider last year, Mr Trump went on to overcome all rivals to clinch the Republican presidential nomination.
Some polls have since indicated he is leading Democrat candidate Hillary Clinton in the presidential race.
Asked by NBC News if Mr Trump could win, Mr Obama said: "I've seen all kinds of crazy stuff happen."
"I think anybody who goes into campaigns not running scared can end up losing," he added.
"My advice to Democrats, and I don't have to give this advice to Hillary Clinton because she already knows it, is you stay worried until all those votes are cast and counted because you know, one of the dangers in an election like this is that people don't take the challenge seriously."
"What I think is scary is a president who doesn't know their stuff and doesn't seem to have an interest in learning what they don't know."
"I think if you listen to any press conference he's given, or listen to any of those debates, basic knowledge - about the world or what a nuclear triad is or where various countries are or, you know, the difference between Sunni and Shia in the Muslim world - those are things that he doesn't know and hasn't seemed to spend a lot of time trying to find out about."
Poll monitors had given Mrs Clinton a double-digit lead over Mr Trump for much of the presidential race, but that lead has since been whittled down.
Mr Trump received a boost nationally, and in key battleground states, after the end of his party's convention last week. Some polls now show he is in the lead over Mrs Clinton.
The Democrats' convention in Philadelphia ends on Thursday.
President Obama, Vice-President Joe Biden and Mrs Clinton's vice-presidential pick, Tim Kaine, will speak at the convention on Wednesday.
On Tuesday, Bill Clinton, made the case for his wife's presidency, calling her the "best darn change-maker I've ever known".
"Hillary opened my eyes to a whole new world of public service by private citizens," he said.
In other key moments on Tuesday:
Mrs Clinton passed the 2,382 delegates needed to claim the nomination after South Dakota announced its delegate vote count
The "Mothers of the Movement", made up of parents who lost a child to police or gun violence, gave a powerful endorsement to Mrs Clinton
Geneva Reed-Veal, the mother of Sandra Bland, who died in a police cell, said: "What a blessing tonight to be standing here so that Sandy can still speak through her momma"
Actress Lena Dunham said: "She knows we have to fight hatred of all kind, and not ignite it for the craven purpose of seeking power"
US election: Obama tells Democrats to be scared of Trump
27 July 2016
Democrats should be "running scared" at the challenge posed by Donald Trump, President Obama has said.