Hayes fought for the Union during the Civil War. He organized a group of volunteers and then joined the Twenty-third Ohio Infantry. He served as a major, but rose up to the rank of major general. He was injured multiple times during the war, including at the Battle of South Mountain in Maryland in September 1862. Several times he suffered injuries because his horse was shot; for example, this occurred at the Battle of Cedar Creek in October 1864. He played a key role in the Union victory at the Battle of Cloyd’s Mountain in Pulaski County, Virginia, that led to the Union destroying a key Confederate railroad. He resigned from the army in June 1865. He distinguished himself with bravery and courage during his military service during the Civil War, fighting in fifty engagements.