The 66-year-old gunman was identified as James T. Hodgkinson of Belleville, Illinois, an ardent supporter of liberal Senator Bernie Sanders - who said he was "sickened" by what he called a "despicable act."
In a national address, Trump appealed for unity following the morning assault in the Washington suburb of Alexandria, Virginia, which came amid high political tension in the US capital after a vitriol-filled 2016 election.
"We are strongest when we are unified and when we work together for the common good," said the president.
Congressman Steve Scalise underwent surgery after being shot in the hip and remained in critical condition, according to MedStar Washington Hospital Centre.
Four others were wounded: a congressional aide, a lobbyist for Tyson Foods, and two US Capitol Police officers.
Trump described Scalise, the number three Republican in the House of Representatives, as a "very good friend" and "patriot," telling him: "America is praying for you and America is praying for all of the victims of this terrible shooting."
The FBI said it had recovered and was attempting to trace two weapons, a rifle and a handgun, and was actively investigating Hodgkinson’s "associates, whereabouts, social media impressions, and potential motivations."
According to his Facebook page, Hodgkinson was a fervent supporter of Sanders, the feisty independent who battled Hillary Clinton for the Democratic presidential nomination last year.
Hodgkinson’s social media posts displayed strong anti-Trump sentiment.
"I know he wasn’t happy with the way things were going, the election results and stuff," his brother, Michael Hodgkinson, told The New York Times. But he said news of the shooting came "totally out of the blue."
Sanders swiftly responded to reports the suspect had volunteered on his presidential campaign.
"I am sickened by this despicable act," he said. "Let me be as clear as I can be. Violence of any kind is unacceptable in our society and I condemn this action in the strongest possible terms."
’RUN, HE’S GOT A GUN’
All Wednesday House votes were cancelled, but the annual congressional baseball game will go on as planned today night at Nationals Park.
After an all-members briefing where Democrats and Republicans held hands and prayed, House Speaker Paul Ryan and top Democrat Nancy Pelosi addressed the somber chamber and proclaimed lawmakers were "united."
The shooting took place just after 7.00am (6.00pm Singapore time) as the Republican team practiced for the well-loved charity showdown.
Congressman Rodney Davis told CNN he was at bat at the time, and Scalise was in the field at second base.
"I was batting, we heard a loud noise ... The next thing I remember was somebody on the field yelling ’Run, he’s got a gun.’"
Alexandria police chief Michael Brown said his officers arrived within minutes and engaged Hodgkinson, together with Capitol Police officers. The gunman was taken into custody and later died of his injuries.
Lawmaker Jeff Duncan said he was leaving the practice when he was approached by a man he later learned was the shooter, who asked if the team was Republican or Democrat before heading toward the field.
"I’m shaken up," Duncan said. "My colleagues were targeted today by someone that wanted to kill them."
Joe Barton, the Republican team manager, arrived at the US Capitol still wearing his red baseball uniform.
"The heroes are the police officers who attacked the shooter, and in doing so quite probably saved many, many lives," the congressman said, his voice breaking.
GUN RIGHTS ADVOCATE
Scalise’s office said the 51-year-old was "in good spirits" before entering surgery, although the hospital later updated his status to critical.
The conservative from the southern state of Louisiana is helping lead the drive to repeal Barack Obama’s health care law.
He is also a firm supporter of the constitutional protection of the rights of Americans to bear arms and last month introduced legislation that relaxes restrictions on interstate gun sales.
Republican lawmaker Mo Brooks described Scalise dragging himself across the field in a bid to escape as the firing continued.
After the shots subsided, several people tended to Scalise. Brooks used his belt as a tourniquet for a bleeding staffer who was shot in the leg.
Several Democrats were practicing at a different field when they heard the news, and immediately gathered to pray for their wounded colleague.
Democrat Nanette Barragan said it will be "bittersweet" when she takes the field for her first congressional baseball game - under tightened security. "We’re going to look over our shoulder a little bit," she said.