According to The Oxford Companion to English Literature (1967),
"the plot is founded on a story told to George Eliot by her aunt Elizabeth Evans, a Methodist preacher, and the original of Dinah Morris of the novel, of a confession of child-murder, made to her by a girl in prison."
The story's plot follows four characters' rural lives in the fictional community of Hayslopeâa rural, pastoral and close-knit community in 1799. The novel revolves around a love "rectangle" among beautiful but self-absorbed Hetty Sorrel; Captain Arthur Donnithorne, the young squire who seduces her; Adam Bede, her unacknowledged suitor; and Dinah Morris, Hetty's cousin, a fervent, virtuous and beautiful Methodist lay preacher. (The real village where Adam Bede was set is Ellastoneon the Staffordshire / Derbyshire border, a few miles from Uttoxeter and Ashbourne, and near to Alton Towers. Eliot's father lived in the village as a carpenter in a substantial house now known as Adam Bede's Cottage).
Adam is a local carpenter much admired for his integrity and intelligence, in love with Hetty. She is attracted to Arthur, the local squire's charming grandson and heir, and falls in love with him. When Adam interrupts a tryst between them, Adam and Arthur fight. Arthur agrees to give up Hetty and leaves Hayslope to return to his militia. After he leaves, Hetty Sorrel agrees to marry Adam but shortly before their marriage, discovers she is pregnant. In desperation, she leaves in search of Arthur but she cannot find him. Unwilling to return to the village on account of the shame and ostracism she would have to endure, she delivers her baby with the assistance of a friendly woman she encounters. She subsequently abandons the infant in a field but not being able to bear the child's cries, she tries to retrieve the infant. However, she is too late, the infant having already died of exposure.
Hetty is caught and tried for child murder. She is found guilty and sentenced to hang. Dinah enters the prison and pledges to stay with Hetty until the end. Her compassion brings about Hetty's contrite confession. When Arthur Donnithorne, on leave from the militia for his grandfather's funeral, hears of her impending execution, he races to the court and has the sentence commuted to transportation.
Ultimately, Adam and Dinah, who gradually become aware of their mutual love, marry and live peacefully with his family.

Question: Why does Hetty leave before her wedding to Adam?
Answer: she is pregnant by Arthur.
Alternative answer: She discovers she is pregnant.