During the expedition against Banu Mustaliq, the companions captured some women as prisoners and wished to be intimate with them without causing pregnancy. They asked the Messenger of Allah ﷺ about this, and he replied, "There is no harm in your not doing so, for Allah has already decreed who is to be created until the Day of Resurrection."
حدثنا عفان حدثنا وهيب حدثنا موسى بن عقبة قال حدثني محمد بن يحيى بن حبان عن ابن محيريز
في غزوة بني المصطلق أنهم أصابوا سبايا فأرادوا أن يستمتعوا بهن ولا يحملن فسألوا رسول الله ﷺ فقال ما عليكم أن لا تفعلوا فإن الله عز وجل قد كتب من هو خالق إلى يوم القيامة
Its isnad is sahih. Ibn Muhayriz is Abdullah, and the hadith was previously mentioned at 11590.