Wilkie Collins was born William Wilkie Collins in Marylebone, London on January 8, 1824. Wilkie's father, William Collins, was a famous landscape painter. Collins was educated in England but also traveled in Europe with his family as a child. As a young man, Collins studied to become a lawyer for five years but began writing instead. He published his first book while still in law school—it was a biography of his father, which appeared in 1848 and had good reviews.

While still a law student, Collins met the extremely popular novelist Charles Dickens. In 1852, Collins published a short story, "A Terribly Strange Bed" in Dickens's magazine, Household Words. Dickens and Collins soon became close friends and would collaborate on stories, travel together, and remain close until Dickens's death in 1870. Collins' first major success, The Woman in White, was serialized in another of Dickens's journals, All the Year Round, beginning in 1859.

Collins's next several novels—No Name (1862), Armadale (1866), and The Moonstone (1868)—were all popular successes, and Collins quickly became famous. At the time of his writing of The Moonstone, however, Collins's health began to decline and would continue to weaken him until his death in 1889, though he would continue to write. For his rheumatic gout, Collins began taking laudanum, a form of opium prescribed by his doctor. Collins quickly became dependent on the drug, and the passages describing Ezra Jennings's opium addiction in The Moonstone are thought to be autobiographical.

The Moonstone is considered to be one of Collins's best novels, and it is usually read within two traditions: sensational fiction and detective fiction. Collins himself wrote the first novel termed "sensation"—The Woman in White. The novels which he wrote in 1860s up to The Moonstone exist within the tradition of the sensation novel, a subgenre of the Victorian novel that was particularly popular in the 1860s. Sensation novels seemingly attempted to excite or frighten with dramatic disclosures and somewhat graphic violence. They took the horror of Gothic fiction and incorporated it within a domestic setting—instead of castles, sensation novels took place in English country estates or London houses. The subject matter of the novels often stemmed from a gripping journalistic story—Collins borrowed details of the case of The Moonstone from the Road Murder Case of 1860 (the crime was the murder of a young boy and the conviction hinged upon a missing, stained dress). He additionally borrowed details of the assault on Septimus Luker and Godfrey Ablewhite in The Moonstone from the media story of an attempted murder on a man in Northumberland Street in London in 1861.

In addition to partaking of characteristics of the sensation fiction genre, The Moonstone also inaugurated an entirely new genre—detective fiction. In 1928, the poet and critic T. S. Eliot declared The Moonstone "the first, the longest, and the best of the modern English detective novel." Though mystery stories, such as those of Edgar Allen Poe, predate The Moonstone, it was the first novel to hold an undisclosed crime and criminal as its center and to make the detection of both by professionals and amateurs alike, the process of the plot. Many of The Moonstone's elements have since become classic features of the detective novel: the eventual conviction of the least-likely suspect; a bungling investigation led by local police and taken over by a more perceptive, slightly eccentric detective; and the "fair-play" format by which no information is concealed from us by the narrator at any given point.

Finally, The Moonstone was additionally unique in that it took the English colonization of India as its frame-setting and underlying subject matter. The novel begins with the battle of Seringapatam (1799), an historical event which secured the power of the English East India Company in India—the company which, in turn, ensured the England's presence and predominance in India throughout the nineteenth century. Collins's depiction of John Herncastle's unethical theft of the diamond from the castle of Seringapatam and the rightful restoration of the diamond to India has been read as a critique of the English colonization of India.