Shepard was appointed a major in the Missouri Militia (Union) on June 18, 1861. In August 1861, he became an assistant adjutant general to Brigadier General Nathaniel Lyon. He was wounded at the Battle of Wilson's Creek on August 10, 1861. He was appointed lieutenant colonel of the 19th Missouri Volunteer Infantry Regiment on August 30, 1861 and colonel of the 3rd Missouri Volunteer Infantry Regiment on January 18, 1862 when the regiments were consolidated. He was appointed colonel of the 51st United States Colored Infantry Regiment on May 9, 1863. As a colonel he led the African Brigade, XVII Corps, Army of the Tennessee, during the Siege of Vicksburg.