The Messenger of Allah ﷺ used to free any slaves who came to him before their masters, once they had embraced Islam. On the day of Taif, he freed two men in this manner.
حدثنا يزيد أخبرنا الحجاج عن الحكم عن مقسم
أن رسول الله ﷺ كان يعتق من جاءه من العبيد قبل مواليهم إذا أسلموا وقد أعتق يوم الطائف رجلين