Holes has many themes, but the major ones are justice, friendship, and the role of fate/destiny and the effect of the past on present events.
Justice is the primary theme in Holes. The novel suggests that traditional law and criminal justice are flawed and do not provide true justice. Stanley is arrested and convicted for stealing shoes that quite literally dropped on him from the sky, the juveniles at Camp Green Lake are treated with harsh cruelty despite being mostly nonviolent children, and Sam is shot and killed for kissing Katherine Barlow. These are all examples of traditional, structured criminal justice which have failed in their execution and become corrupt and misguided. Instead, the novel presents examples of individuals seeking justice on their own as the true form of retribution. Stanley finds justice when he defies the rules of Camp Green Lake and uncovers the information needed to shut down the institution; Kate Barlow gets justice for Sam's death by becoming an outlaw who finally gives the men in town the kisses they always beg her for, only this time her kisses are fatal; and Madame Zeroni finally finds justice when Stanely breaks the curse and carries her descendant, Zero, up the mountain while singing Madame Zeroni's lullaby.
Friendship is presented in the novel as a means of survival and a comfort in trying times, as well as a means of overcoming differences. Although Stanley is told to shun Zero and even fear him, the friendship he finds with Zero is the only thing that makes Camp Green Lake bearable. They support each other and help each other through the cruelties of the camp, and when Zero runs away Stanley follows him. It is only together that they are able to survive in the desert. Without Zero, Stanley would never have found anything to eat, and without Stanely, Zero never would have made it up the mountain to find water. We see a different portrayal of friendship in Kate Barlow's timeline. She is pursued by many men but none of them treat her as an equal or show her any respect. However, she and Sam develop a relationship that is based in a friendship and mutual respect first that then becomes romantic over time. Their friendship overcomes the racial divide between them.
Another theme we see in Holes is the idea of predestined or fated events, and how the events in the past affects the present. Many events and characters in the story are intricately interwoven, often without the awareness of any of the characters involved. Stanley's ancestor, Elya Yelnats, brought a curse upon his family after he broke a promise to Madame Zeroni, who is coincidentally Zero's ancestor. Though the boys have no knowledge of this, their destinies seem to be connected. Zero was the one who stole the shoes that Stanley was arrested for stealing, and without his actions, neither of them would have ended up at Camp Green Lake. It is also only by running away from camp together that they are unwittingly given the opportunity to break the curse that has plagued Stanley's family. When they run away, they also find solace in the jars of preserved peaches in a rotted, overturned boat, never knowing that the boat belonged to Sam, the lover of Kissin' Kate Barlow, who robbed Stanley's great-grandfather and is the reason that they are digging holes in the desert under the Warden's watch. The list could go on and on. Every moment of these characters' lives are dictated by and haunted by the past, even if they aren't aware.