[54] Hayes and his troops did not arrive in time for the battle, but joined the Army of the Potomac as it hurried north to cut off Robert E. Lee's Army of Northern Virginia, which was advancing into Maryland.[54] Marching north, the 23rd was the lead regiment encountering the Confederates at the Battle of South Mountain on September 14.[55] Hayes led a charge against an entrenched position and was shot through his left arm, fracturing the bone.[56] He had one of his men tie a handkerchief above the wound in an effort to stop the bleeding, and continued to lead his men in the battle. While resting, he ordered his men to meet a flanking attack, but instead his entire command moved backward, leaving Hayes lying in between the lines.
Eventually, his men brought Hayes back behind their lines, and he was taken to hospital. The regiment continued on to Antietam, but Hayes was out of action for the rest of the campaign.[57] In October, he was promoted to colonel and assigned to command of the first brigade of the Kanawha Division as a brevet brigadier general.