John Cairns was born at Ayton Hill in Berwickshire in 1818, the third of eight children of a shepherd. Although he had to leave school at thirteen to help his father, his intellectual gifts had been noticed and he was tutored part-time for three years. In 1834 he entered the University of Edinburgh and in 1841 received his MA, standing first in classics and philosophy and sharing first in mathematics. Answering the call to become a minister, he studied theology, travelled widely on the Continent and became proficient in German.
In 1845 he was ordained and inducted into the charge of Golden Square Secession Church in Berwick upon Tweed. In 1847 the United Secession Church united with the Relief church to form the United Presbyterian Church. Within a few years Cairns came to be recognised as the most eminent theologian of his denomination and gained a formidable reputation throughout Europe as a church leader. In the complex church politics of 19th-century Scotland the United Presbyterians were noted for their theological liberalism and voluntarist (disestablishmentarian) principles.
Cairns remained in Berwick for thirty-one years until he was appointed professor, and from 1879 Principal, at the United Presbyterian Divinity Hall in Edinburgh.