William served in Company E of the 51st Regiment of the Illinois Volunteers during the Civil War. He enlisted on 26 February 1864. On 28 March, the 51st (which had been on leave in Chicago) left Union Station for Nashville, Tennessee via Louisville, Indiana. From Nashville they marched nearly 150 miles on foot to Chattanooga, Tennessee where they were armed. By 3 May they were marching under General Thomas as part of General Sherman’s Atlanta Campaign.
William and the 51st engaged in numerous small skirmishes throughout May and into June, pushing against the army of General Hardee. In May they engaged in the Battle of Rocky Face Ridge, the Battle of Resaca, and the Battle of Dallas. In June they pushed steadily toward the town of Marietta, Georgia which the Confederates defended from a series of mountain tops and trenches. On the 27th they launched an unsuccessful attack in which Company E lost one of its officers, Archibald McCormick (William would go on to name one of his sons Archibald in 1877).
In July they pursued the Confederate Army towards Atlanta participating in the Battle of Peach Tree Creek (north of Atlanta) on the 20th and reaching the outskirts of the city on the 23rd. The 51st stayed here until the Battle of Jonesborough on 1 September which forced General Hood to abandon Atlanta to General Sherman.
The 51st rested and resupplied for most of the next two months. In late November the 51st was marching north to Nashville from Alabama. On the 29th they took up the defense of the Union retreat under General Hood’s advance at the Battle of Columbia. On the 30th they met the initial thrust of Hood’s attack in the Battle of Franklin, being crushed between the Confederates and their own defensive line outside of Franklin, Tennessee. Over 150 from the 51st were either killed, captured, or wounded in this battle. The same night, without sleep, the remaining soldiers (2 officers and 23 enlisted)5) marched to Nashville.
On 16 December the 51st participated in the Battle of Nashville, crushing the Confederate Army of Tennessee. The 51st went on to pursue the remnants for over 100 miles through Tennessee and Alabama. They stayed in Huntsville, Alabama through all of March 1865. In April they returned to Nashville and William was discharged on 19 June for disability for which he would receive a pension.