I have a slave-girl and I practise 'azl with her, whereupon Allah's Messenger (ﷺ) said: This cannot prevent that which Allah has decreed. The person then came (after some time) and said: Messenger of Allah, the slave-girl about whom I talked to you has conceived, whereupon Allah's Messeuger (ﷺ) said: I am the servant of Allah and His Messenger.
Sahih Muslim Book 16, Hadith 159