Barnum entered the U.S. service on May 13, 1861, as captain of Company I, 12th N.Y. Infantry, at the age of 27; and afterward in October 1861 was promoted to major of that regiment. He served with distinction with that command, including the Peninsula Campaign under Maj. Gen. George B. McClellan, until July 1, 1862, when he was dangerously wounded by gunshot through the left ilium, at Malvern Hill, Virginia. At the time, the wound was supposed to be mortal; his body was abandoned and fell into the hands of the enemy, but afterward, he returned to the Union lines, so far recovered from his injury as to accept a commission as colonel in the 149th New York, dated October 4, 1862, rank September 17, 1862, and was mustered into service with the regiment at Syracuse, New York.