Born in Philadelphia, Pennsylvania, to a prosperous Federal judge, Barnes studied medicine at Harvard University, but left before finishing his studies due to ill health. He later studied medicine with Surgeon GeneralThomas Harris of the United States Navy, and received his medical degree from the University of Pennsylvania in 1838. After graduation, he served a year as resident physician at Blockley Hospital and for another year as visiting physician for the northwestern district of Philadelphia.
Barnes appeared before an army examining board which was meeting at the time in Philadelphia and, pursuant to its recommendation, he was commissioned an assistant surgeon on June 15, 1840. he was assigned for his first duty to the United States Military Academy. After only a few months of duty, he was ordered to accompany a detachment of recruits to Florida, where hostilities were in progress against the Seminole Indians. For the two following years, he served successively at eight posts in that state, much of the time giving professional service to two or more posts at the same time, owing to the shortage of medical officers. Notable in his field service of this period was his accompanying Brigadier General Willam Harney's expedition through the Everglades during the Second Seminole War.
War with Mexico
In 1842, Barnes was assigned to Fort Jesup, Louisiana, where he remained until 1846 when with the beginning of the Mexican–American War, he joined the 2nd U.S. Dragoons en route to Corpus Christi to join the army being mobilized for the invasion of Mexico from the north. He served with the cavalry column of Major General Zachary Taylor's army during its advance to Monterey. Later transferred to Lieutenant General Winfield Scott's forces before Veracruz, he served with Major General William J. Worth's division during the siege and capture of that city. During the advance upon Mexico City, he was chief surgeon of the cavalry brigade and participated in the battles of Cerro Gordo, Contreras, Churubusco, and Molina del Rey, in the storming of Chapultepec and the capture of the capital. During the thirteen years that intervened between this time and the Civil War, Barnes served in a succession of posts in widely separated parts of the country. He served at Fort Croghan and other posts in Texas, in the plains country at Fort Scott, Fort Leavenworth, and Camp Center, on the Pacific coast at San Francisco, Fort Vancouver and the Cascades, while between times he saw tours of duty at Baltimore, Fort McHenry, Philadelphia, and West Point. He was promoted to major and surgeon on August 29, 1856. Marriage at Fort Leavenworth, KS to MaryThurston Fauntleroy b. 1825 d. 1911, dau of Col. Thomas Turner Fauntleroy b. 1795 d. 1883 and Ann Magill b. 1792 d. 1862, dau Col. Charles Magill of Winchester, VA.
Civil War
In April 1861, Barnes was stationed at the Army's Fort Vancouver in Washington Territory, the second-ranking officer behind future Union general Edward Ord. On June 4, he was ordered east and departed Fort Vancouver on June 24, 1861. He soon served successively as medical director of the forces under Major General David Hunter, medical director of the Western Department, and medical director of the Department of Kansas. On May 2, 1862, he was ordered to report to the Surgeon General in Washington and upon reporting was assigned to duty as attending surgeon for the city. While on this duty he formed the acquaintance of U.S. Secretary of War Edwin M. Stanton, who quickly gained a highly favorable impression of him. On February 9, 1863, Barnes was appointed a medical inspector with the rank of Lieutenant Colonel, stationed in Washington. On August 10, 1863, he was further advanced to the position of medical inspector general with the grade of Colonel. It was but a few weeks after this advancement that the difficulties between Stanton and Surgeon General William Alexander Hammond culminated in the detachment of the latter from his office. On September 3, 1863, Barnes was by a special order of the War Department "empowered to take charge of the bureau of the Medical Department of the army and to perform the duties of Surgeon General during the absence of that officer." He assumed the office of acting Surgeon General the following day thus beginning one of the longest and most eventful administrations in the history of the office. On August 22, 1864, he was advanced to the position of Surgeon General, with the grade of Brigadier General and on March 13, 1865, he received the brevet of major general for faithful and meritorious service during the war. As principal assistant, Barnes brought to his office Major Charles Henry Crane, who continued in the capacity throughout the eighteen years of his term and succeeded to the office upon the retirement of his chief.
Lincoln assassination
On April 14, 1865, at the time of the assassination of United States President Lincoln and the attempted assassination of Secretary of State William H. Seward, Barnes attended the death bed of Lincoln and ministered to the successful restoration of Seward. The morning after Abraham Lincoln's death, three Army Medical Museum pathologists entered the White House to perform an autopsy on Lincoln's body. Overseen by Barnes, the autopsy was conducted by Colonel Joseph Woodward and Major Edward Curtis. The autopsy began at 11 a.m. on April 15, 1865.
Medical museum
The work of collecting material for the Army Medical Museum and for the Medical and Surgical History of the War of the Rebellion was pushed vigorously during the years 1863 and 1864. The question of the military control of general hospitals was a vexing one from the beginning of the war. A War Department order of April 7, 1862, placed them under the supervision of the Surgeon General, but was not sufficiently explicit in its provisions regarding the right of command of the medical officers in charge of these hospitals. It was not until December 27, 1864, that the question was finally settled by General Order No. 306, confirming the medical officer's right to command in his own sphere of action. The good will of Secretary Stanton was again shown by an order of February 8, 1865, giving to the medical department entire control of hospital transports and hospital boats.
Post-war career
The Medical and Surgical History of the War of the Rebellion was first suggested by Surgeon General Hammond in a circular to medical officers inviting cooperation in the collection of material. In 1865 there was issued by the Surgeon General a report upon the extent and nature of the material available for its preparation. Four of the six monumental volumes were completed under General Barnes' administration and the other two were far advanced at the time of his retirement. His regime was further notable for the interest he took in the development of the Army Medical Library. During his term of office, the library, under the supervision of Major John S. Billings, was expanded from a small collection of text-books to first rank among medical libraries of the country.
Garfield assassination and retirement
In 1881, during the long struggle of President James A. Garfield to live after being shot, Barnes was one of the surgeons who for weeks served in the chamber of the dying president. The protracted service and anxiety incident to the care of the latter took a heavy toll on Barnes' health. An Act of Congress passed June 30, 1882, providing for compulsory retirement for age, found Barnes nearly a year past the statutory age and he was retired on June 30, 1882.
Death
A chronic nephritis, of which Barnes was a subject for some time, caused his death at his home in Washington on April 5, 1883.