As part of a Thanksgiving call to US troops, Trump said he had just learned that Specialist Sarah Beckstrom, 20, had died, while Staff Sergeant Andrew Wolfe, 24, was fighting for his life.
"She's just passed away," Trump said. "She's no longer with us. She's looking down at us right now. Her parents are with her."
The president called Beckstrom an "incredible person, outstanding in every single way".
Trump used the announcement to say the shooting allegedly by Rahmanullah Lakanwal was a terrorist attack as he criticised the Biden administration for enabling Afghans who worked with US forces during the Afghanistan War to enter the US without, in his opinion, sufficient vetting.
"This atrocity reminds us that we have no greater national security priority than ensuring that we have full control over the people that enter and remain in our country," Trump said. "For the most part, we don't want them."
Trump also suggested the shooter was mentally unstable after the war and departure from Afghanistan.
"He went cuckoo. I mean, he went nuts," the president said. "It happens too often with these people."
Earlier, US officials said Afghan national Lakanwal, 29, who worked with the CIA in his native country and immigrated to the US in 2021, drove from Washington state to the nation's capital before the shooting.
The suspect had worked in a special CIA-backed Afghan Army unit before emigrating from Afghanistan, according to two sources, and #AfghanEvac, a group that helps resettle Afghans who assisted the US during the two-decade war.
Jeanine Pirro, the US attorney for Columbia, said Lakanwal launched an "ambush-style" attack with a .357 Smith & Wesson revolver on Wednesday local time.
The suspect currently faces charges of assault with intent to kill while armed and possession of a firearm during a crime of violence. Pirro said it's too soon to say what the suspect's motives were.
"We are praying that they survive and that the highest charge will not have to be murder in the first degree. But make no mistake, if they do not, that will certainly be the charge."
The suspect who was in custody also was shot and had wounds that were not believed to be life-threatening, according to a law enforcement official.
A resident of the eastern Afghan province of Khost who identified himself as Lakanwal's cousin said Lakanwal and his brother had worked in a special Afghan Army unit known as Zero Units in the southern province of Kandahar.
CIA director John Ratcliffe said in a statement Lakanwal's relationship with the US government ended shortly following the chaotic evacuation of American troops from Afghanistan.
Lakanwal has been living in Bellingham, Washington, north of Seattle, with his wife and five children, said his former landlord.
In a video message released on social media, Trump called for the reinvestigation of all Afghan refugees who entered under the Biden administration.
Director of US Citizenship and Immigration Services Joseph Edlow said in a social media post Trump had directed him to review the green cards of people from countries "of concern".
Edlow didn't name the countries. But in June, the administration banned travel to the US by citizens of 12 nations and restricted access from seven others, citing national security concerns.