Sayyiduna Buraydah (may Allah be pleased with him) said that a woman of Ghamid (may Allah be pleased with her) came and said: "O Messenger of Allah, purify me, for I have committed adultery." The Prophet (peace and blessings be upon him) said: "Go back." She said: Just as you were sending Sayyiduna Ma'iz (may Allah be pleased with him) back, you are sending me back in the same way; by Allah, I am pregnant. He (peace and blessings be upon him) said: "Go back until you give birth to it." When she gave birth to the child, she brought him wrapped in a cloth and again asked him (peace and blessings be upon him) for the stoning. The Prophet (peace and blessings be upon him) said: "Take him and nurse him until he begins to eat food." Some time later she came again, and the child had a piece of bread in his hand. The Prophet (peace and blessings be upon him) handed the child over to a man, and it was ordered for the woman that a pit be dug; the woman was placed in it up to her chest, and then he ordered the people to stone her. Sayyiduna Khalid bin al-Walid (may Allah be pleased with him) threw a stone, and the spatter of her blood fell on Sayyiduna Khalid (may Allah be pleased with him), so he reviled her. At this the Prophet (peace and blessings be upon him) said: "Be quiet, Khalid! She has repented with such a repentance that if one who levies unjust taxes were to repent like it, he too would be forgiven." Then he gave the order, the funeral prayer was offered over her, and she was buried.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الحدود / 16966