He was born in Maidstone, Kent, the son of an army surgeon, and trained at University College London and Edinburgh University, qualifying as a Member of the Royal College of Surgeons in 1838. He entered the Indian Medical Service and was posted Assistant-Surgeon in Bengal in 1840. In 1853 he became Surgeon, in 1860 Surgeon-Major and ultimately Deputy Inspector-General of Hospitals. He was also Professor of Medicine in the Bengal Medical College. He spent 30 years in India, where he was a leading figure in the field of education, in which he was a major campaigner to establish the first universities in India and prison reform, including holding the post of Inspector-General of Gaols in lower Bengal. In 1857, during the Indian Mutiny, he was asked to investigate the Andaman Islands as a potential penal colony. He subsequently published a book about his Andaman experiences: Adventures and researches among the Andaman islanders (1863).
He retired to the UK in 1870 and started a new career as an Inspector for the Local Government Board. He was also an active member of the Royal Statistical Society, becoming its President in 1890.
He died in 1897 and was cremated at Woking. He left a widow and four stepchildren. He married twice, first in 1842 to Mary Rennards Boyce and secondly in 1889 to Margaret Kay, daughter of John Fawcus.