Ibn Muhayriz (may Allah have mercy on him) says: I entered the mosque and saw Sayyiduna Abu Sa'id al-Khudri (may Allah be pleased with him). I sat with him and asked about coitus interruptus ('azl). Sayyiduna Abu Sa'id (may Allah be pleased with him) said: We went out with the Messenger of Allah (peace and blessings be upon him) on the expedition of Banu al-Mustaliq, and we obtained Arab slave-girls. We desired women, and staying away from women had become hard for us, and we also loved (to receive) ransom, so we intended to practise 'azl. Then we thought: We will not practise 'azl without asking while the Messenger of Allah (peace and blessings be upon him) is present among us; we should ask first. So we asked, and he (peace and blessings be upon him) said: "Do so, but any soul that is to come into existence will certainly come."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب السير / 18072