The novel is set in the early 19th century in both British-occupied India and in Yorkshire, a county in the North of England known for its rolling moorland and dramatic scenery. Yorkshire is also the setting of several important Victorian and early 20th-century novels, including Emily Brontë's Wuthering Heights and Charles Dickens' Nicholas Nickelby—Charlotte Brontë's Jane Eyre is also set somewhere in Northern England.
Much of the action of this book happens in labyrinthine, enormous houses with lots of empty rooms. Misselthwaite Manor has "over one hundred" rooms, many of which are locked up and inaccessible. The sense of characters being trapped inside and free outside is very pervasive, especially toward the beginning, when Mary is unfamiliar with the twisting passages and locked doors of Misselthwaite.
The Gothic, ecstatic outdoor settings of Yorkshire range from storm-lashed and bare moorland at the beginning of the book to gorse-furred wonderland by the end. The landscape seems to be affected by the emotions and perceptions of the people who are experiencing it. The moorland of the North of England and the idyllic, tended gardens of Misselthwaite Manor take on similar characteristics when Mary, Colin, and Dickon come together to explore them; they are filled with delightful surprises, friendly animals, and opportunities to learn and improve.
Some of the novel also happens outside of England, in the country of Mary's birth. Burnett's stereotypical and often overtly racist depictions of Colonial India introduced a new generation of children to received "wisdom" about a land of "snake-charmers" and "silent, obedient servants." India is described as a distant place full of magic, mystery, and the exotic, stereotypical ideas Mary only strengthens and reproduces as she tells her English friends about the many differences between the two places.