Maj. Gen. Jessica Wright, commander of the state Guard, called it "truly a sad day."
"There are no words for the loss we feel," she said in a statement from Fort Indiantown Gap.
Baum's death marked the first fatality for the 56th Stryker Brigade Combat Team, a 4,000-member unit that represents the Pennsylvania Guard's largest overseas deployment since World War II.
The brigade arrived in the Taji area north of Baghdad last month and is expected home around September. Officially, it isn't to take over its sector of Iraq from a Hawaii-based Army brigade until today. Already, it has had a death and at least one unrelated combat injury.
Since 9/11, the Pennsylvania Guard has lost 28 soldiers in Iraq and five in Afghanistan.
The Guard reported that Baum had been with a quick-reaction force that raced to the scene of a roadside bomb explosion near Mushada, Iraq.
He was shot at that site. No other soldier was hurt during the incident, the Guard said.
Col. Marc Ferraro, leader of the 56th Brigade, said: "Staff Sgt. Baum was a dedicated, professional soldier who loved his family and his country. We send out our heartfelt condolences to his family. He will be deeply missed."
Formerly an active-duty soldier, Baum had served a previous tour of duty in Iraq. He also was a member of peacekeeping forces in Kosovo and the Sinai Peninsula.
Spec. Brian Mandes of Jennersville, a groomsman at Baum's marriage celebration on Dec. 27, said that Baum had missed the camaraderie of being with troops after he left the active Army.
That was why he joined the Guard in 2005, though he knew there was a chance he might be ordered again to Iraq.
"His wife didn't want him to join up, but he missed doing something," said Mandes, a fellow Iraq veteran who was held back this time because of an injured back.