"It may be hard to comprehend the twisted logic that led to this tragedy," Mr Obama said in a speech delivered at the memorial service.
"And for what he has done, we know that the killer will be met with justice - in this world, and the next."
In his speech, Mr Obama mentioned each of the dead by name, but he did not mention Hasan by name.
The president and the first lady, dressed in black, then followed US military tradition by placing a coin in front of a photograph of each of the dead.
Mr Obama, who has been criticised for his initial reaction to the tragedy and accused of misjudging the public mood, put back a trip to Asia to attend the service on the army base in Texas.
As investigations into the massacre continued, the FBI admitted its agents had been warned about Major Hasan as part of an anti-terrorism inquiry a year before the Fort Hood massacre but decided he posed no danger.
Robert Mueller, the director of the FBI, ordered an inquiry into why emails between the army psychiatrist and Anwar al-Awlaki, a radical imam in Yemen who had contact with two of the September 11 hijackers, were not followed up.
Hasan had also openly declared that in order to avoid "adverse events", the army should allow Muslims to be released as conscientious objectors.
In a lecture given to senior army doctors 18 months before the shootings, he talked about Osama bin Laden, the Taliban, jihad and suicide bombers while projecting a slide onto a wall which read: "We love death more than you love life!"
Despite the presentation at Walter Reed Army Medical Center in Washington, Hasan was later ordered to deploy to Afghanistan. A short time after that, he went on his gun rampage.
Hasan had sent between 10 and 20 emails to Awlaki, who replied twice.
The first emails were picked up by US intelligence in Dec 2008 and passed to the FBI, which said they consisted of questions from Hasan and "innocuous" replies from Alwaki.