He then taught in Chapel Hill for a year, before moving to Florida. In 1857, he was appointed to the U. S. Survey Corps, and worked in Minnesota for over a year. He then returned to North Carolina and became assistant engineer on the Wilmington and Weldon Railroad.[2]

When the Civil War began, Lewis joined the Confederate army as the third lieutenant of Company A, 1st North Carolina Regiment ("Bethel").[1] His first fighting came in the Battle of Big Bethel on June 10, 1861. By January 1862, he had been promoted to major and took part in the Battle of New Bern. For his actions at New Bern, he was promoted to lieutenant colonel of the 33rd North Carolina Infantry. Lewis fought with the regiment at the Seven Days Battle and the Battle of Malvern Hill. During the later months of 1862, he took part in the defense of Richmond.

Lewis returned to North Carolina in December 1862 and took part in the fighting in and around New Bern and Kinston. In the spring of 1863, his regiment returned to Virginia and he took part in the Gettysburg Campaign with the 43rd North Carolina Infantry as part of Brigadier General Junius Daniel's Brigade of Major GeneralRobert Rodes' Division. At Gettysburg, the regimental commander, Colonel Thomas S. Kenan, was wounded and captured, and Lewis took command of the regiment.

After the Confederate retreat from Gettysburg, Lewis returned to North Carolina and took positions around New Bern. He subsequently took part in the fighting to recapture Plymouth. He led Robert Hoke's brigade at the Battle of Cold Harbor and was promoted to brigadier general following the battle in June 1864. He was then wounded during Jubal Early's raid on Washington.[2] In 1864, he married Martha Luncinda "Mittie" Pender, first cousin of Major General Dorsey Pender.[1] Lewis also supervised the entrenchment of Drewry's Bluff, Virginia. He took part in a skirmish near Farmville, Virginia, on April 7, 1865, but was once again wounded and captured during the fighting. He was paroled within two weeks. Throughout his military service in the Confederate Army, Lewis saw action in thirty-seven battles and skirmishes.[1]

Following the war, Lewis returned to his peace time career as a civil engineer, serving as the State Engineer of North Carolina for thirteen years, plus many years as road-master, construction engineer, chief engineer, and general superintendent for several railroads. In 1899, he was chief engineer for the Albany and Raleigh Railroad.[2]