Abu Abdur Rahman Salmi says that Sayyiduna Ali (may Allah be pleased with him) addressed us in a sermon and said: O people! Establish the prescribed punishments on your slaves, whether they are married or unmarried. A slave woman of the Messenger of Allah (peace and blessings be upon him) committed adultery, so he ordered me to flog her. When I went to her (to flog her), she had just given birth to a child a short while before. I was afraid that if I flogged her, she would die. So I met the Noble Prophet (peace and blessings be upon him) and mentioned this to him, and he (peace and blessings be upon him) said: You did the right thing.
Hadith Referenceالمنتقى ابن الجارود / كتاب الطلاق / 816