Sunan an-Nasa'i, Book 26, Hadith 169 (In-Book)

It was narrated from Salamah bin Al-Muhabbaq that a man had intercourse with a slave woman belonging to his wife, and was brought to the Messenger of Allah. He said: "If he forced her, then she is free at his expense and he has to give her mistress a similar slave as a replacement. If she obeyed him in that, then she belongs to her mistress, and he has to give her mistress a similar slave as well."

أَخْبَرَنَا مُحَمَّدُ بْنُ عَبْدِ اللَّهِ بْنِ بَزِيعٍ، قَالَ حَدَّثَنَا يَزِيدُ، قَالَ حَدَّثَنَا سَعِيدٌ، عَنْ قَتَادَةَ، عَنِ الْحَسَنِ، عَنْ سَلَمَةَ بْنِ الْمُحَبَّقِ، أَنَّ رَجُلاً، غَشِيَ جَارِيَةً لاِمْرَأَتِهِ فَرُفِعَ ذَلِكَ إِلَى رَسُولِ اللَّهِ صلى الله عليه وسلم فَقَالَ ‏ "‏ إِنْ كَانَ اسْتَكْرَهَهَا فَهِيَ حُرَّةٌ مِنْ مَالِهِ وَعَلَيْهِ الشَّرْوَى لِسَيِّدَتِهَا وَإِنْ كَانَتْ طَاوَعَتْهُ فَهِيَ لِسَيِّدَتِهَا وَمِثْلُهَا مِنْ مَالِهِ ‏" ‏ ‏.‏

sunnah.com