Set in pre-revolutionary France, the novel opens with a philosophical question: Does Providence reward virtue, or does it allow the virtuous to suffer while the wicked prosper? The narrator argues that depicting a virtuous person crushed by misfortune can serve as a moral lesson.
The story begins with Madame de Lorsange, a wealthy libertine of about 30 whose fortune rests on seduction, murder, and crime. She and her younger sister Justine were raised in a Paris convent as daughters of a wealthy banker. When both parents die in quick succession, the girls are orphaned with almost nothing. The elder sister, then called Juliette, urges 12-year-old Justine to pursue a libertine path. Justine refuses, and the sisters part ways. Juliette enters a brothel, eventually murders a husband for his fortune, and climbs through society. She now lives as companion to Monsieur de Corville, a powerful councillor of state.
At an inn, Corville and Lorsange notice a young woman in chains escorted by constabulary. The guards say she is accused of murder, theft, and arson, yet seems the sweetest creature they have ever transported. Lorsange, privately troubled that this possibly innocent girl faces execution while she herself has prospered through real crimes, persuades Corville to hear the prisoner's story.
Using the name Thérèse, the prisoner recounts her life. After her parents' deaths she searches for honest work in Paris but is rebuffed everywhere. The merchant Dubourg attempts to assault her. She takes a position with the miserly moneylender du Harpin, who tries to recruit her as a thief. When she refuses, du Harpin frames her for theft and has her arrested.
In prison, Justine meets Dubois, a notorious criminal also facing execution. Dubois sets a fire that kills 21 inmates but allows both women to escape. She urges Justine to embrace crime; Justine refuses on religious grounds. The gang's four male accomplices subject Justine to degrading acts, though her virginity is preserved. Their leader, Ironheart, delivers speeches denying God's existence and arguing that Nature alone governs the universe.
The gang captures a merchant named Saint-Florent. Justine saves his life and helps him escape with his fortune. In return, he leads her into the forest, beats her unconscious, rapes her, steals her money, and abandons her. This establishes the defining pattern of Justine's existence: Every act of virtue is repaid with cruelty.
Justine encounters the Comte de Bressac, a young aristocrat who despises women and is openly homosexual. He places her as companion to his aunt, the Marquise de Bressac. After four years, Bressac demands Justine poison the Marquise to hasten his inheritance. Justine warns the Marquise instead. Bressac intercepts the Marquise's plea for outside help; the Marquise soon falls dangerously ill, apparently poisoned through unclear means, and dies. Bressac punishes Justine by setting dogs on her and declares she will be accused of the murder.
Wounded and destitute, Justine reaches the surgeon Rodin, who treats her wounds. Rodin runs a boarding school that conceals the sexual abuse of his pupils. When Justine discovers that Rodin and his colleague Rombeau plan to dissect Rodin's 14-year-old daughter Rosalie alive for anatomical study, she attempts a rescue but is caught. Rodin brands her shoulder with a hot iron, the mark of a convicted thief, to discredit any future testimony.
Traveling south, Justine arrives at the Benedictine monastery of Sainte-Marie-des-Bois, drawn by reports of its piety. The Father Superior, Dom Severino, hears her confession, but his questions are driven by lust. He leads her to a hidden underground compound where four monks keep 16 captive women as sexual slaves. Her companion Omphale, a count's daughter imprisoned for 18 years, explains the regime: Girls are abducted from noble families, subjected to systematic sexual servitude, and when discharged, never heard from again. Omphale suspects they are murdered. After months of captivity, Justine escapes by sawing through her window bars and descending on a rope fashioned from bed linen. Passing through the compound's hedgerows, she discovers skulls and human remains confirming that discharged captives are killed.
Justine next falls into the hands of the Comte de Gernande, who keeps his young wife prisoner and bleeds her every four days to satisfy a vampiric sexual compulsion. Justine and the Comtesse plot to alert the wife's mother, but Gernande discovers the letter and imprisons Justine. When the Comtesse collapses, Gernande rushes away, leaving the doors unlocked, and Justine escapes.
In Lyons, Justine learns that Rodin has been appointed Principal Surgeon to the Empress of Russia. Saint-Florent, now wealthy and powerful, offers her a position procuring girls for his sexual exploitation. She refuses. Near Vienne, she rescues a man named Roland who turns out to lead a counterfeiting ring. He enslaves her, chaining her to a wheel alongside other captive women. In an underground burial chamber he subjects her to sadistic rituals and murders another captive, Suzanne, during a near-hanging game. When his fortune is secured through foreign bills of exchange, he departs after shooting his own sister dead.
Roland's successor, Dalville, frees the women from the wheel and improves their quarters, but constabulary soon raids the operation. Justine is taken to Grenoble, where the magistrate Monsieur S—— proves her innocence. She encounters Dubois again, now posing as a baroness, who proposes robbing the young merchant Dubreuil. Justine warns Dubreuil instead; grateful and moved by her story, he proposes marriage. However, Dubois has poisoned Dubreuil at dinner, and he dies that evening. Dubois flees with Justine's belongings.
Traveling with a merchant-woman named Madame Bertrand and her infant, Justine stops at an inn in Villefranche. Dubois's agents set the inn ablaze. Justine rushes through the fire to save Bertrand's baby but loses her grip, and the child falls into the flames. Dubois abducts Justine and delivers her to an unnamed aristocrat whose pleasure consists in decapitating women. He murders another captive before Justine's eyes, but when he and Dubois collapse from drunkenness, Justine escapes.
Bertrand accuses Justine of arson, theft, and child-murder. Dubois identifies Justine to constabulary and mentions the brand on her shoulder. Imprisoned in Lyons, Justine appeals to Father Antonin, a monk from the monastery now heading his order's local house. He offers help only in exchange for sexual slavery, and when she refuses, rapes her and denies knowing her. Saint-Florent lures her to his mansion, where he and the corrupt judge Cardoville subject her to torture and fabricate evidence against her. She is sentenced to death and sent to Paris for confirmation.
As her tale ends, Lorsange asks the prisoner's true identity. The prisoner reveals she is Justine, and Lorsange realizes the condemned woman is her own sister.
Corville vouches for Justine's innocence and secures her custody. At the couple's chateau, Justine receives devoted care, medical treatment that removes Rodin's brand, and a royal pardon clearing all charges. Arrest warrants for her persecutors prove futile, as they hold powerful government positions.
Despite her restored fortune, Justine grows somber and anxious, convinced her happiness cannot last. During a violent thunderstorm, she rushes to close the windows. A bolt of lightning strikes and kills her instantly. Gazing at her sister's corpse, Lorsange experiences a sudden conversion, renounces her life of vice, and enters a Carmelite convent. Corville rises to high office. The narrator concludes that true happiness is found in virtue alone, and that God compensates virtue's earthly persecution with heavenly rewards.