William Somerville, military surgeon, was the eldest son of Reverend Thomas Somerville and his wife Martha Charters. He was educated in Edinburgh, where he obtained a medical degree, and in March 1793 joined the army as a hospital assistant. In 1795 he accompanied the troops under Major-General Sir James Craig, who carried out the first British occupation of the Cape of Good Hope. Craig described him as "an extremely clever and useful young man" and during the next few years he was appointed to various posts, several of which he held simultaneously. Soon after the occupation, either in November 1795 or in May 1796, he was appointed garrison surgeon. On 1 January 1796 he became inspector of lands and buildings (non-military), a post in which he relied on the expertise of L.M. Thibault*. He also became Graig's private secretary. When Lord Macartney was appointed governor of the Cape in 1797 he appointed Somerville as secretary of the Court of Appeals. In August 1799 he accompanied Major-General Dundas to the eastern districts, following the so-called Van Jaarsveld Rebellion against the government and conflict between the settlers and the Xhosa on the eastern frontier. When the resident commissioner of Graaff-Reinet, H.C.D. Maynier, fell ill, Somerville was sent out as assistant resident commissioner in April 1800. He accompanied Maynier on a visit to Chief Ngqika of the Xhosa to discuss peace proposals and after further discussions with other parties co-signed the report on the mission, dated 14 August 1800. Meanwhile he was awarded the degree Doctor of Medicine (MD) by King's College, University of Aberdeen, on 27June 1800, which means that he received the degree in absentia. In 1801 he was appointed commissary of lands and woods at Algoa Bay while still retaining his other posts.
From 1 October 1801 to April 1802 Somerville accompanied an expedition to the country of the Tlhaping (known to the early settlers as the Beriqua), north of the Orange River, led by P.J. Truter* and including the artist Samuel Daniell*. Although one object of the expedition was to explore a region as yet unknown to the colonists, its main aim was to barter cattle in order to alleviate the chronic food shortage at the Cape. The "Expedition to the Beriqua", as it was called, reached the Sak River, beyond the colonial boundary, on 21 October and arrived at the south bank of the Orange River near present Prieska on 1 November. They proceeded as far north as Lattakoo, becoming the first Europeans to meet and describe the southern Tswana. Extensive negotiations led to the exchange of only some 200 head of cattle, but much was learned about the region and its people. Somerville kept a journal of the expedition and was a signatory of the official report to the governor. The report included the first description of the impala. However, most of Somerville's descriptions of the fauna and flora lacked scientific rigour. He had wide interests, but not much in-depth knowledge. On the other hand he provided a useful description of Tlhaping society and his obervations on the Kora and the few San the expedition encountered were remarkably accurate for the time. Of particular importance was his paper on the anatomy of Khoi women, "Observationes quadem de Hottentotis, praesertim de structura genitalium peculiari Hottentotarum", published in the Medico-Chirurgical Transactions (London) in 1816. It was again published (in English), with Somerville's journal, by Bradlow & Bradlow (1979) and has been described as "a model of clarity [that] reveals appreciable insight into such human biological enigmas as steatopygia and macronympha (tablier)" (Tobias, 1985, p. 4).
Somerville probably left the Cape before or at the end of the first British occupation in 1803 and in 1805 served under General Craig in the Mediterranean. In 1807 he went with Craig to Canada. There, under Craig as governor-general, he became inspector-general of hospitals and comptroller of customs until 1811. He returned to Britain as Craig's personal physician, but Craig died early in 1812. In May that year Somerville married Mary Fairfax (1780-1872), mathematician and author, who was one of the most prominent women of her time and with whom he had two daughters. Somerville College in Oxford was named after her. He was again deputy inspector of Army hospitals in 1813, first in Portsmouth and then in Edinburgh. In December 1815 he became a principal inspector of the Army Medical Board, but retired on half-pay in December 1816 and moved to London. Turning to civilian medicine, he was admitted as a licentiate of the Royal College of Physicians (LRCP) in June 1817 and in December that same year was elected a Fellow of the Royal Society of London. In 1819 he became physician to the Royal Chelsea Hospital. Most of his time was spent in furthering his wife's remarkable scientific career until 1838, when he moved to continental Europe after a serious illness. He was still held in high regard at the Cape many years after leaving the colony, as shown by his election as an honorary member of the South African Institution (a scientific society) in 1830.