Born in Keresley on the outskirts of Coventry, Warwickshire, England, on 10 September 1936, Hartshorn was the son of Bernard Hartshorn and Christine Evelyn Hartshorn (née Bennett). He studied at Imperial College London, from where he graduated BSc and ARCS, and at University College, Oxford, where he obtained a DPhil in 1960. His doctoral thesis was titled Steroid hormone analogues.
Hartshorn married Jacqueline Joll in 1963, and the couple went on to have four sons. He became a naturalised New Zealand citizen in 1965.