At the age of 25, Hoffman enlisted for Civil War military service. After enrolling at Philadelphia on August 10, 1861, he then officially mustered in that same day as a private with Company E of the 72nd Pennsylvania Infantry (also known as the "Fire Zouaves"). Transported with his regiment to Virginia, he saw action in the Battle of Ball's Bluff (October 21, 1861), participated in the advances by the Union troops of Major-General Nathaniel P. Banks on Winchester and Yorktown, and fought in the Seven Days Battles of Seven Pines (also known as Fair Oaks, May 31 to June 1, 1862), Savage's Station (June 29, 1862), and Malvern Hill (July 1, 1862) before engaging in the battles of Antietam (September 17, 1862), Fredericksburg (December 12–15, 1862), and Chancellorsville (April 30 to May 6, 1863). On October 1, 1863, he was transferred to the 143rd Company of the 2nd Battalion, U.S. Veteran Reserve Corps (also known as the invalid corps), and was subsequently honorably mustered out.