No further information was immediately available from police but a local ABC News reporter said that the suspect is "active duty US Navy".
The shooter went into a business, causing people inside to flee, Frederick Police Chief Jason Lando said.
The two people who were shot had "life-threatening" injuries, Allen Etzler, spokesman for the Police Department, said, as quoted by the New York Times. There are two victims... He could not say whether the shooting was inside or outside.
According to police, a shooting happened at an address where a concrete business is located and about four miles from Fort Detrick.
Mr Lando said: "We have two different scenes".
"All I can tell you is that we have confirmed there is only one shooter". The victims were flown by helicopter to Baltimore and are in critical condition, Lando said.
Shortly thereafter, police learned that the suspected gunman, a 38-year-old male, "traveled to the Fort Detrick military base" and was shot by "personnel on the base".
"The public is no longer at risk".
After the shooting, a victim entered a nearby business, Nicolock Paving Stones, and asked for help, a person there said.