On October 12, 1861, Bagby joined the Confederate Army, serving as a major in the 7th Regiment of Texas Mounted Volunteers[3][4] Bagby served in Brigadier General Henry Hopkins Sibley's Army of New Mexico during the New Mexico Campaign from February to April 1862.
[3][4] In the Second Battle of Galveston, on January 1, 1863, Bagby led his "Horse Marines" aboard an improvised gunboat[3] in the capture of the USS Harriet Lane.
[3][8] Bagby was wounded in the arm during the battle but would not leave the field until a Union Army attack was driven back.
[3] Bagby's cavalry then harassed the retreat of the Union Army under Major General Nathaniel P. Banks from Mansfield to Simmesport, Louisiana.
[3][4] In the absence of action on his request,[4] and despite his lack of formal authority to make promotions,[1] Smith assigned Bagby to duty as a brigadier general on April 13, 1864, to rank from March 17, 1864.
[3][4] On May 16, 1865, after Robert E. Lee and Joseph E. Johnston had surrendered their armies, the Confederate Senate had held their last meeting and Jefferson Davis had been captured by Union troops, General E. Kirby Smith assigned Bagby to duty as a major general.
[4][11] He later moved to Hallettsville, Texas, where he continued his law practice and became a prominent member of the state bar.