Dalton Ursulean, of Niagara, Wis., learned his punishment on Monday in Michigan's Dickinson County District Court after earlier pleading no contest to placing harmful objects in food.
A no contest plea isn't an admission of guilt but is treated as such at sentencing.
Ursulean apologized during the hearing, saying he wants to "actually do right." Defense lawyer Geoffrey Sparks said Ursulean now recognizes that his actions were "dumb and disgusting."
Authorities say Ursulean spit in a sandwich ordered by an officer from the Oscar Johnson VA Medical Center in Iron Mountain, Mich., on Aug. 25, 2012.
During the sentencing hearing, the court was informed that Ursulean tested positive for the infectious disease hepatitis C, The Daily News of Iron Mountain reported. Sparks said his client was unaware of the infection.
"He had no idea until the blood tests came back," Sparks said. "He was very alarmed when he found out about it."
The officer, who tested negative for the disease, said he has a fear of blood-borne pathogens since the incident.