On July 9, the 23rd was transferred with the rest of the VI Corps to Washington, D.C., in response to Jubal Early's attack on the city. After Early's retreat back into the Shenandoah Valley, the regiment, along with the VI and XIX Corps followed the Confederates. On September 8, the 23rd was mustered out of service, with those men who enlistments had not expired yet being transferred to the 82nd Pennsylvania Infantry.