Ramsay was born at Fraserburgh, Aberdeenshire, Scotland, the son of William Ramsay, ship's carpenter, and Margaret Ogilvie of Angus. Apprenticed to a local surgeon, and later educated at King's College, Aberdeen from 1750 to 1755, he obtained his MA in 1753 and went on to continue his surgical training in London under Dr. George Macaulay.