Robert Barrie was born May 5, 1774, in St Augustine, Florida, to Dr. Robert Barrie of Sanquhar, Scotland, and Dorothea (Dolly) Gardner. His father died a year later, and in 1784, Dolly moved her family back to Preston, England. She soon married textile manufacturer George Clayton.
On June 5, 1788, Barrie entered the Royal Navy and worked under his uncle Captain Alan Gardner. Two years later he was appointed midshipman on the Discovery for Captain George Vancouver's voyage to the Pacific. Upon return to England in 1795, Barrie was promoted quickly to lieutenant, then to commander in 1801, to captain of the Sloop Calypso in 1802, and served as captain of the Pomone between 1806 and 1811.
In 1812, Barrie became the captain of the HMS Dragon and commodore in charge of the British squadron. In this year he played an important role in the blockade of Chesapeake Bay and captured 85 American vessels. Barrie participated in many battles on the Atlantic coast during the War of 1812, including the British attack on the Penobscot River region in Maine in 1814.
After the war, Barrie married Julia Wharton Ingilby (c.1795-1836), daughter of Sir John Ingilby, in Warrington (Cheshire), England. They moved to France, and had four daughters and one son.
In January 1819, Barrie moved to Canada as the commissioner of the dockyard at Kingston, located on Point Frederick. There he commanded the inland waterways of the Canadas, such as the Great Lakes and the port of Quebec, and prepared the navy for possible future engagements with the United States. He was called back to England in 1825, and was promoted to commodore first class before returning to Kingston in 1827. He relocated permanently to England in 1834, when the dockyard establishment was broken up, and, shortly after, was knighted Knight Commander of the Hanoverian Order (KCH) by King William IV, promoted to Rear Admiral in 1837, and made Knight Commander of Bath (KCB) in 1840. Barrie died on June 7, 1841, in Swarthdale, England.