Abu Abd al-Rahman al-Sulami (may Allah have mercy on him) said: I heard Sayyiduna Ali (may Allah be pleased with him) delivering a sermon. After praising and glorifying Allah, he said: O people! Whichever male or female slave commits adultery, apply the prescribed punishment to them; if he is married, flog him. A maidservant of the Prophet (peace and blessings be upon him) had committed adultery, and he (peace and blessings be upon him) sent me to apply the punishment. I found her in the state of postnatal bleeding, and I feared that if I struck her she would die. So I left her at that time, and when she recovered I struck her. The Prophet (peace and blessings be upon him) said: "You did well."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الحدود / 17004