Police have identified James Holmes, 24, as the man who opened fire at a midnight showing of the new Batman movie, "The Dark Knight Rises," killing 12 and wounding 59 others in Aurora, Colo.
Obama cut short his campaign trip in Florida, instead delivering a brief address in Fort Myers.
"There are going to be other days for politics," Obama said. "This, I think, is a day for prayer and reflection."
Obama touched on the fragility of life, his concerns as the father of two daughters, and urged Americans to "spend a little time thinking about the incredible blessings that God has given us."
"Our time here is limited and it is precious," Obama said. "And what matters at the end of the day is not the small things, it's not the trivial things, which so often consume us and our daily lives. Ultimately, it's how we choose to treat one another and how we love one another."
Romney also curtailed campaign events, delivering brief remarks at what was to be a rally in Bow, N.H.
"This morning, Colorado lost youthful voices which would have brightened their homes, enriched their schools and brought joy to their families," he said. "Our prayer is that the Comforter might bring the peace to their souls that surpasses their understanding."
Paraphrasing the apostle Paul, Romney said, "Blessed be God ... who comforteth us in all our tribulations, that we may be able to comfort them which are in any trouble."
Religious leaders urged wounded victims and relatives of the deceased to put their faith in a higher power.
"As Catholic bishops, we weep with those who weep," said Archbishop Samuel Aquila and Auxiliary Bishop James Conley of Denver, citing, like Romney, the apostle Paul.
"But in Aurora, which means 'the dawn,' the sun rose this morning," the bishops continued. "In a city whose name evokes the light, people of hope know that the darkness may be overcome."
The Catholic bishops also prayed for the perpetrator of the shooting and for his conversion.
"Evil ruled his heart last night," Aquila and Conley said in a statement. "Only Jesus Christ can overcome the darkness of such evil."
The Billy Graham Rapid Response Team quickly sent chaplains to the scene in Aurora, as they have after mass killings in Tucson, Ariz., in 2011 and at Virginia Tech University in 2007.
Other religious leaders argued that the U.S. needs tougher gun control laws. Holmes had four guns, including an assault rifle, according to law enforcement authorities.
Kathryn Mary Lohre, president of the National Council of Churches, called on elected officials to "seek policies that will foster greater peace in our communities and throughout this country."
The NCC, which represents about 10,000 congregations -- most from mainline Protestant, historically African-American and Orthodox traditions -- passed a resolution on ending gun violence in 2010.
Rabbi David Saperstein, director of the Religious Action Center of Reform Judaism, echoed the NCC's call, noting that the shooting occurred in the same state as the 1999 Columbine High School attack.
"Although details about this gunman and shooting are still coming to light, this horror reinforces the need to ensure that common-sense gun control laws are in place to help reduce such acts of violence," Saperstein said.
Jesuit Fr. James Martin, culture editor at America magazine, tweeted on Friday morning: "Gun control is a pro-life issue. ... Pray for the families of the victims and for an end to the taking of life by senseless violence."
Later Friday, the popular spiritual author Anne Lamott tweeted, "Lord have mercy, Christ have mercy. Is no one going to say that these massacres (wouldn't) happen if the crazy men had to use bats or hammers?"
Rep. Louie Gohmert, R-Texas, on the other hand, argued that the shooting occurred because Americans have become unmoored from their moral and religious foundations.
"You know what really gets me, as a Christian, is to see the ongoing attacks on Judeo-Christian beliefs, and then some senseless crazy act of a derelict takes place," Gohmert said on "Istook Live!", a broadcast of the conservative Heritage Foundation.
The Texas congressman also suggested that Americans have lost the "protective hand" of God because school prayer is not allowed at public schools.
"Where was God? What have we done with God? We don't want him around," Gohmert said.
"Rep. Louis Gohmert truly tortures logic when he concludes that this violence had something to do with perceived attacks on majority faith in America," said Roy Speckhardt, executive director of the American Humanist Association.
"At a time when families are mourning in the wake of this tragedy, Gohmert used it as an opportunity to push a religious agenda," Speckhardt said.
The Rev. Welton Gaddy, Interfaith Alliance president, called on Americans to unite "regardless of faith or belief" to comfort the victims and the families. As I have said after past incidents, we as a nation need to be done forever with the thought that killing settles anything."