Deuteronomy 22:21

Then they shall bring out the damsel to the door of her father’s house, and the men of her city shall stone her with stones that she die: because she hath wrought folly in Israel, to play the whore in her father’s house: so shalt thou put evil away from among you.

Stoning to death stood among the penalties for certain forms of sexual wrongdoing, which were treated as especially harmful to the people. For a maiden found to have been immoral in her father's house, the requirement was to be made a public example and stoned to death in shame. A maiden guilty of playing the whore in her father's house would thus suffer the dreadful calamity of stoning to death for her shame.

When Mary's pregnancy was discovered she was taken to be guilty under this law, so to expose her publicly would have meant her death. In charity her betrothed determined to conceal her evident guilt by putting her away privately instead of enforcing the penalty. Being taken to be wife by the man to whom she was espoused would cover that shame and avert that death. Mary therefore stood exposed to stoning unless her betrothed became convinced of her innocence in the miraculous conception and took her as wife.