When John Stuart Mill, the philosopher and economist, organised a massive petition to Parliament to give women the right to vote, he had Somerville put her signature first on the petition.
When she died in 1872, Mary Somerville was hailed by The Morning Post as "The Queen of Nineteenth-Century Science".
Somerville was the daughter of Vice-Admiral Sir William George Fairfax, scion of a distinguished family of Fairfaxes, and she was related to several prominent Scottish houses through her mother. She was born at the manse of Jedburgh, in the Borders, which was the house of her maternal aunt, wife of Dr Thomas Somerville (1741–1830) (author of My Own Life and Times). Her childhood home was at Burntisland, Fife. She was the second of four surviving children (three of her siblings had died in infancy). She was particularly close to her oldest brother Sam. The family lived in genteel poverty because her father's naval pay remained meagre as he rose through the ranks. Her mother supplemented the household's income by growing vegetables, maintaining an orchard and keeping cows for milk. Her mother taught her to read the Bible and Calvinist catechisms, and when not occupied with household chores Mary roamed among the birds and flowers in the garden. In her autobiography Somerville recollects that after returning from sea her father said to her mother "This kind of life will never do, Mary must at least know how to write and keep accounts". Thus the 10-year-old was sent for a year of tuition at Musselburgh, an expensive boarding school. Somerville learned the first principles of writing, rudimentary French and English grammar. Upon returning home, she:
"...was no longer amused in the gardens, but wandered about the country. When the tide was out I spent hours on the sands, looking at the star-fish and sea-urchins, or watching the children digging for sand-eels, cockles, and the spouting razor-fish. I made collections of shells, such as were cast ashore, some so small that they appeared like white specks, some so small that they appeared like white specks in patches of black sand. There was a small pier on the sands for shipping limestone brought from the coal mines inland. I was astonished to see the surface of these bocks of stone covered with beautiful impressions of what seemed to be leaves; how they got there I could not imagine, but I picked up the broken bits, and even large pieces, and brought them to my repository."
During bad weather she occupied herself with reading the books in her father's library, including Shakespeare, and fulfilling her "domestic duties". In later life she recollected "These occupied a great part of my time; besides, I had to shew my sampler, working the alphabet from A to Z, as well as the ten numbers, on canvas". Her aunt Janet came to live with the family and reportedly said to her mother "I wonder you let Mary waste her time in reading, she never shews more than if she were a man". As a consequence Mary was sent to the village school to learn plain needlework. The youngster "was annoyed that my turn for reading was so much disapproved of, and thought it unjust that women should have been given a desire for knowledge if it were wrong to acquire it." The village school master came to the house on several evenings in the week to teach Mary. He taught her how to use the two small globes in the house. In her Personal Recollections Mary notes that in the village school the boys learned Latin, "but it was thought sufficient for the girls to be able to read the Bible; very few even learnt writing."