They identified him as Fantahun Girma Woldesenbet, whose rank was E-4.
"We are still investigating motive, investigating the exact circumstances," Army Brig. Gen. Michael J. Talley told reporters at an afternoon news conference.
The gunman was stopped at the post's gates, but before the vehicle could be searched the shooter took off. He was stopped about 1/2 mile onto the installation, where he got out of the car, brandished a weapon and was shot by police, Talley told reporters.
Frederick Police Chief Jason Lando said the first shooting took place at "a military institution" in the Riverside Tech Park. In a news release, the police department said the building is a warehouse rented by Naval Medical Research Center, Biological Defense Research Directorate to store research supplies and equipment.
The chief said the gunman used a rifle but did not provide any additional information on the weapon.
One victim is in critical condition but is stable at a hospital. The second victim is in serious condition but likely will be released Wednesday. Both were taken from the scene by helicopter, police said.
Police were called around 8:20 a.m.
After the shooting, a victim entered a nearby business, Nicolock Paving Stones, and asked for help, a person there said.
"Our team was able to assist them and called the authorities," a statement released by Jeremy Mutschler, director of marketing and advertising at Nicolock, reads. The statement emphasizes that the shooting did not happen at Nicolock.
Agencies helping Frederick police include the FBI; the Bureau of Alcohol, Tobacco, Firearms and Explosives; Maryland State Police; and the Frederick County Sheriff's Office.
The FBI is handling the first shooting scene, officials said.
Frederick is about a 50-mile drive northwest of Washington, DC. Woldesenbet did not live on Fort Detrick, officials said.
CNN's Joe Johns, Amanda Watts and Michael Callahan contributed to this report.