The son of a lawyer, Barnard was born in Sheffield, Massachusetts. Graduating second in the U.S. Military Academy’s class of 1833 earned for him a commission as a brevet second lieutenant in the Corps of Engineers. His earliest work was mostly in the construction and repair of fortifications on the East and Gulf Coasts.
In the war with Mexico (1846–48), Barnard oversaw the construction of the defenses of Tampico and surveyed battlefields around Mexico City. After the conflict he explored and surveyed a route for the proposed railroad across the Isthmus of Tehuantepec in Mexico. Back in the United States, he served on a number of engineer boards and commissions. He also directed the improvement of navigation of rivers and harbors as well as further work on coastal fortifications, including those of San Francisco Bay and New York Harbor. He was the superintendent of the U.S. Military Academy in 1855 and 1856.
Major Barnard began his Civil War service as Chief Engineer, Department of Washington. His reconnaissance of the ground at Bull Run helped Brig. Gen. Irvin McDowell formulate his battle plans. As Chief Engineer of the Army of the Potomac, 1861–62, Barnard’s most important assignment was to construct the defenses of Washington and its environs. When finished, the defenses consisted of a formidable 37-mile ring around the city, with 68 forts linked by 20 miles of trenches, and 93 artillery batteries that mounted 807 cannons and 98 mortars. He was made a brigadier general of volunteers while engaged in this work.
Barnard served with the Army of the Potomac in the Peninsula Campaign, in which he directed the siege works at Yorktown, Virginia, and reconnoitered potential battle sites. His valuable contributions to the campaign earned for him the rank of brevet colonel in the Regular Army. He returned to Washington where he once again became the chief engineer of its defenses. Barnard was promoted to the lineal rank of lieutenant colonel in 1863. He sat on several boards, most of which were responsible for devising the defenses of important locations in the North, including the Canadian border. In the last years of the war he served on Lt. Gen. Ulysses S. Grant’s staff as chief engineer “of the Armies in the field.” In this capacity he performed engineering duties at the siege of Petersburg and through the victorious Appomattox Campaign. His accomplishments were rewarded with brevets to brigadier general and major general in the Regular Army and a promotion to colonel of engineers.
During the Civil War President Abraham Lincoln offered him the position of Chief Engineer, which Barnard declined. His reasons are not known with certainty, but contemporaries believed that he preferred not to be elevated over officers senior to him.
After the war Barnard again received assignments to many boards and commissions, such as the Lighthouse Board, a joint Army–Navy board for harbor defenses, and a commission sent to Europe to gather information on the manufacture of iron for defensive uses. He was also engaged in several civil works projects, including canal construction and the improvement of harbors and the James, Mississippi, and Missouri Rivers.
Barnard was a prolific author, having written several works on a variety of topics, including the gyroscope, mathematics, seacoast defense, the North Sea Canal in the Netherlands, and the defenses of Washington and New York City. General Barnard received several honors, such as honorary degrees from the University of Alabama (1838) and Yale College (1864). He was also an incorporator of the National Academy of Sciences (1863).
Unlike many of his engineer colleagues in the Civil War, he continued to perform engineering duties rather than command troops in combat. His contributions to the Union’s ultimate victory, however, were momentous. Barnard’s crowning wartime achievement was the planning for and construction of the defenses of Washington.