"At this difficult time, the people of Oak Creek must know that the American people have them in our thoughts and prayers, and our hearts go out to the families and friends of those who were killed and wounded," Obama said in a statement issued by the White House.
"As we mourn this loss which took place at a house of worship, we are reminded how much our country has been enriched by Sikhs, who are a part of our broader American family," the president said.
The gunman opened fire and killed six people at a Sikh temple near Milwaukee before he was killed in an exchange of gunfire with a police officer, authorities said.
A White House official said Obama was notified of the Wisconsin shooting shortly before 1 p.m. EDT by Homeland Security Adviser John Brennan.
Mitt Romney, likely Republican challenger for the presidency, also expressed his sorrow about the shooting.
"This was a senseless act of violence and a tragedy that should never befall any house of worship," Romney said in a statement. "Our hearts are with the victims, their families, and the entire Oak Creek Sikh community. We join Americans everywhere in mourning those who lost their lives and in prayer for healing in the difficult days ahead."