The Adventures of Huckleberry Finn takes place along the Mississippi River in the American South, starting in a fictional town in Missouri and moving through Illinois, Kentucky, and Arkansas. Though Mark Twain wrote and published Huckleberry Finn in the 1880s—many years after the conclusion of the Civil War and the end of slavery—the novel takes place in the pre-Civil War era, sometime around the 1830s or 1840s, when slavery was still legal and “runaway” slaves (like the character Jim) were hunted down and persecuted.
Though Huck and Jim spend significant amounts of time on land, they spend the bulk of the novel on a raft on the Mississippi River, a large body of water that extends from Minnesota through the Gulf of Mexico. Existing outside of boundaries and borders, the river comes to represent freedom for both Huck (seeking to escape his abusive father, Pap) and Jim (seeking to escape slavery). At the same time, the natural world away from the oppressions of society presents its own challenges: loneliness, constant fear of being caught, unpredictable storms, and more.
Also important to the setting of the novel is the Second Great Awakening, a Protestant religious revival that Twain was critical of given the ways that, as he saw it, Christian “morality” did not amount to morality at all (given the overwhelming Southern Christian support for slavery). This skepticism about Christianity is evident in Huck and Jim's superstitions, as the book implies that their beliefs aren't any more irrational than Christian dogma.