In the summer of 1861, Gregg resigned his seat in the provisional Confederate Congress to join the army. He became the colonel of the 7th Texas Infantry. He was present at the surrender of Fort Donelson and was subsequently captured and exchanged. Gregg was promoted to brigadier general upon his return to service and assigned to a detachment of the Army of the Northern Virginia. He was severely wounded in the Battle of Chickamauga. After his recovery, he participated in the Battle of the Wilderness, with his Texas brigade. He continued through the Overland campaign of 1864; however, he was killed in action in October 1864.