Born in Philadelphia, Egbert joined the Union Army during the American Civil War, being commissioned a first lieutenant in the 12th U.S. Infantry Regiment on September 23, 1861. With the Army of the Potomac, Egbert participated in the battles of Gaines Mills and Malvern Hills. He was taken prisoner twice, during the battles of Cedar Mountain and Gettysburg, being exchanged once and escaping during Robert E. Lee's retreat from Gettysburg. He was wounded in the Battle of Bethesda Church. He was promoted to captain on April 1, 1865.