The corps was initially created out of various Union commands as part of the Middle Department in the Shenandoah Valley on July 12, 1862, and was placed under the command of Major General John E. Wool. It spent most of 1862 guarding the Baltimore and Ohio Railroad lines between Baltimore, Harpers Ferry, and Winchester. The corps, then led by Robert C. Schenck, played a major role in the early stages of the Gettysburg Campaign, where elements of the corps unsuccessfully opposed Robert E. Lee's initial advance through the Shenandoah. The second division, under Robert H. Milroy, suffered heavy casualties during the Second Battle of Winchester on June 13-15, 1863, and elements of the corps also took part in the delaying action at Martinsburg a few days later. The badly battered corps withdrew to Harpers Ferry after that, playing no further role in the campaign, until it helped join in George G. Meade's pursuit of Lee following the Battle of Gettysburg.
The VIII Corps played a major part in the defense of Washington from Jubal Early at Monocacy on July 9, 1864 under the commander of Maj. Gen. Lew Wallace. The primary duty of the VIII Corps in 1864 was rear echelon duties in Maryland guarding the Baltimore and Ohio Railroad. Elements of the corps also battled Confederate cavalry as it raided across Maryland to the suburbs of Baltimore during Early's Raid on Washington. The headquarters of the department was located in Baltimore.
The VIII Corps is often confused with the Army of West Virginia which served in the Shenandoah Valley and western Virginia throughout 1864. This confusion stems from the Army of West Virginia being composed of troops that had served in the Eighth Corps in 1863 but were officially transferred to the Department of West Virginia by the time of the 1864 Campaigns. It is furthermore confusing in the fact that the Army of West Virginia functioned as a corps within the Army of the Shenandoah. The result was references to the Army of West Virginia as the VIII Corps even though they were never officially synonymous.