Mu'awiya b. Suwaid reported:

I slapped a slave belonging to us and then fled away. I came back just before noon and offered prayer behind my father. He called him (the slave) and me and said: Do as he has done to you. He granted pardon. He (my father) then said: We belonged to the family of Muqarrin during the lifetime of Allah's Messenger (may peace be upon him. and had only one slave-girl and one of us slapped her. This news reached Allah's Apostle (ﷺ) and he said: Set her free. They (the members of the family) said: There is no other servant except she. Thereupon he said: Then employ her and when you can afford to dispense with her services, then set her free.
حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، حَدَّثَنَا عَبْدُ اللَّهِ بْنُ نُمَيْرٍ، ح وَحَدَّثَنَا ابْنُ نُمَيْرٍ، - وَاللَّفْظُ لَهُ - حَدَّثَنَا أَبِي، حَدَّثَنَا سُفْيَانُ، عَنْ سَلَمَةَ بْنِ كُهَيْلٍ، عَنْ مُعَاوِيَةَ بْنِ سُوَيْدٍ، قَالَ لَطَمْتُ مَوْلًى لَنَا فَهَرَبْتُ ثُمَّ جِئْتُ قُبَيْلَ الظُّهْرِ فَصَلَّيْتُ خَلْفَ أَبِي فَدَعَاهُ وَدَعَانِي ثُمَّ قَالَ امْتَثِلْ مِنْهُ ‏.‏ فَعَفَا ثُمَّ قَالَ كُنَّا بَنِي مُقَرِّنٍ عَلَى عَهْدِ رَسُولِ اللَّهِ صلى الله عليه وسلم لَيْسَ لَنَا إِلاَّ خَادِمٌ وَاحِدَةٌ فَلَطَمَهَا أَحَدُنَا فَبَلَغَ ذَلِكَ النَّبِيَّ صلى الله عليه وسلم فَقَالَ ‏"‏ أَعْتِقُوهَا ‏"‏ ‏.‏ قَالُوا لَيْسَ لَهُمْ خَادِمٌ غَيْرُهَا قَالَ ‏"‏ فَلْيَسْتَخْدِمُوهَا فَإِذَا اسْتَغْنَوْا عَنْهَا فَلْيُخَلُّوا سَبِيلَهَا ‏"‏ ‏.‏
Reference : Sahih Muslim 1658 a
In-book reference : Book 27, Hadith 49
USC-MSA web (English) reference : Book 15, Hadith 4081
  (deprecated numbering scheme)