Barnes joined the 47th Regiment of Foot in 1792, and quickly rose to field rank. He was promoted to lieutenant-colonel in 1807, serving in the Invasion of Martinique in 1809, and colonel in 1810. Two years later, he served on Wellington's staff in the Peninsular War. His services in this capacity gained him further promotion; as a major-general, he led a brigade in the Battle of Vitoria and took part in the battles the Pyrenees, Nivelle, Nive and Orthez. He was awarded the Gold Cross and three clasps for his Peninsula service. Barnes served in the campaign of 1815 as adjutant-general, and was wounded at the Battle of Waterloo, where he was known as "our fire eating adjutant general". Already a KCB, he was a recipient of the Austrian Order of Maria Theresa 3rd Class, and the Russian Order of St Anne.