Mishkat al-Masabih 3564
Ali said:
You people must carry out the punishment on your slaves, those of them who are married and those who are not, for a slave woman belonging to God’s Messenger committed fornication and he ordered me to beat her. But she had recently given birth to a child and I was afraid that if I beat her I might kill her, so I mentioned that to the Prophet and he said, “You have done well." 

Muslim transmitted it.

In a version by Abd Dawud he said, “Leave her till her blood stops flowing and then carry out the punishment on her, and carry out* the punishment on your female slaves”.

Abu Dawud.

*Here the verb is plural.
وَعَنْ عَلِيٍّ رَضِيَ اللَّهُ عَنْهُ قَالَ: يَا أَيُّهَا النَّاسُ أَقِيمُوا عَلَى أَرِقَّائِكُمُ الْحَدَّ مَنْ أُحْصِنَ مِنْهُمْ وَمَنْ لَمْ يُحْصَنْ فَإِنَّ أَمَةً لِرَسُولِ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ زَنَتْ فَأَمَرَنِي أَنْ أَجْلِدَهَا فَإِذَا هِيَ حَدِيثُ عَهْدٍ بِنِفَاسٍ فَخَشِيتُ إِنْ أَنَا جَلَدْتُهَا أَنْ أَقْتُلَهَا فَذَكَرْتُ ذَلِكَ لِلنَّبِيِّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ فَقَالَ: «أَحْسَنْتَ» . رَوَاهُ مُسْلِمٌ. وَفِي رِوَايَةِ أَبِي دَاوُدَ: قَالَ: «دَعْهَا حَتَّى يَنْقَطِعَ دَمُهَا ثُمَّ أَقِمْ عَلَيْهَا الْحَدَّ وَأَقِيمُوا الْحُدُودَ عَلَى مَا مَلَكَتْ أَيْمَانكُم»