Wilson was born to John Wilson and Annie Clerk Harper in the parish of Glencorse, Midlothian. After his father's death in 1873, his family moved to Manchester. He studied biology at Owen's College to become a doctor. He then joined Sidney Sussex College, Cambridge to study Physics and Chemistry.