Press Secretary Sarah Sanders also tweeted about the shooting. Two are in surgery in critical condition.
The attack is being investigated as a hate crime.
Before boarding Air Force One, Trump told reporters, "They had a maniac walk in and they didnt have any protection and that is just so sad to see".
No children died in the attack, he added. "Tree of Life * Or L'Simcha is perhaps the biggest congregation in the area".
The gunman is now in custody after surrendering to the authorities.
US President Trump, speaking at Joint Base Andrews following the shooting, praised the actions of law enforcement for doing "an outstanding job".
He was inside the synagogue for 20 minutes before officers arrested him.
In previous mass shootings, Trump has at times said he would consider tightening certain gun controls but in the main has called for more armed guards in places such as schools.
"It's a very tight-knit community", said Saul Markowitz, a Pittsburgh resident and president of Markowitz Communications.
He said: "These senseless acts of violence are not who we are as Americans". The name of the merged community is Tree of Life-Or L'Simcha. Here's what we know so far about this horrific tragedy. "Risky weapons are putting our citizens in harm's way".
Four police officers were among six people injured in the shooting, Pittsburgh Public Safety Director Wendell D. Hissrich said.
"There are multiple casualties". As a precaution, I have directed State Police to increase patrols around Jewish centers and houses of worship across the state.
The shooting at the Squirrel Hill synagogues is only the second shooting at a synagogue in USA history, and the first that appears to have been motivated by anti-Semitic animus. He said SWAT officers grabbed the man's weapons.
"It sounded like a loud crash in the hallway", he told the Post-Gazette.
Shortly after 11 a.m., President Donald Trump tweeted about the shooting. "Law enforcement on the scene", he wrote. The Tree of Life congregation would have about 40 people present, another group meeting for Sabbath services in the basement would have 30 to 40 people and a third Jewish congregation meeting for a study session would have about 15 people.
- Dodgers win longest World Series game ever 3-2
- Researchers Have Found Microplastics in Human Waste for the First Time
- [First Cut] iPhone XR: The "Affordable" New iPhone
- Islamic Jihad group announces Gaza ceasefire with Israel
- Florida Democrat Andrew Gillum targeted by second racist robocall
- Tim Cook Calls for Strong Privacy Protections
- Top smartphones for gaming
- Package intercepted at DE mail facility, addressed to Joe Biden
- Saudi prosecutors: Jamal Khashoggi killing was premeditated
- Florida man arrested in connection with pipe bomb packages