Hearn was born in Belturbet, County Cavan, Ireland, the son of Reverend William Edward Hearn (a curate and later a vicar) and Henrietta Hearn (née Reynolds). He was the second of seven sons in the family. Hearn was educated at Portora Royal School in Enniskillen, Ireland and later studied at Trinity College at the University of Dublin from 1842. There he was highly successful in his study of classics, logic and ethics, graduating with a Bachelor of Arts degree in 1847. Following his studies in arts, Hearn also studied law, at Trinity College and later at King's Inns in Dublin and Lincoln's Inn in London, and was admitted to the Irish Bar in 1853.