In 1861, as a result of reforms by Tsar Alexander II of Russia, some twenty three million serfs (Russian peasants owned by landowners) were emancipated. While this was a beautiful thing, it constituted a major restructuring of Russian society and was therefore the cause of much chaos and turmoil.
At that time, St. Petersburg was the capitol of Russia and a major economic center. Dostoevsky's Crime and Punishment focuses on some of the grimmer aspects of St. Petersburg in the 1860s. Through Raskolnikov's eyes, we see streets crawling with drunkard, vagabonds, and molesters. Poverty is everywhere and no child is safe. His move to the prison in Siberia presents an interesting contrast. Siberia is represented as pure and natural, untouched by the pollution and vice in which his St. Petersburg is drowning.
This seems at first ironic when we consider that this is also the location of the federal prison. Yet, Crime and Punishment views the prison not as a continuation of suffering, but rather as a hospital for criminals, a place to heal and find redemption. Or rather, the suffering is horrible, because prison life is no joke, but this suffering was part of the process and therefore was welcome.
St. Petersburg is the "big" setting of the novel, but the smaller spaces are interesting, too. Take Raskolnikov's room as an example. It's small, grimy, and depressing, and is even blamed for his awful psychological state. With the exception of Porfiry, everybody we meet lives in terribly cramped places. The problem is obviously most acute in terms of families. Nobody has space to breathe or move, not to speak of privacy. The homes in the novel are places of violence, abuse, and chaos.
Most of the novel is set during the summer. We are constantly told that it's hot and stuffy to an unreasonable degree. This aspect of setting certainly contributes to the "powder-keg" feeling we get while we are reading, as if everything is on the verge of some huge explosion.