David dropped out of the US Naval Academy after the Civil War began and joined the 5th Alabama Infantry. He also served in the Confederate States Navy. The last record of him is dated June 1865, when he swore an Oath of Allegiance to the US government in Chattanooga, Tennessee.
Compiled Service Records of Confederate Soldiers contains the following information: Barnum, David, Pvt., Co. D, 5th Regt. Ala. Vol. Subject Appointed Navy Acting Master. Special Order Number 211/8, Sept. 5, 1863. Adjutant and Inspector General's Office, Confederate States, contains information relative to the man named, on the subject mentioned above.