(9) باب الاِسْتِثْنَاءِ فِي الأَيْمَانِ
Narrated Abu Huraira:
(The Prophet) Solomon said, "Tonight I will sleep with (my) ninety wives, each of whom will get a male child who will fight for Allah's Cause." On that, his companion (Sufyan said that his companion was an angel) said to him, "Say, "If Allah will (Allah willing)." But Solomon forgot (to say it). He slept with all his wives, but none of the women gave birth to a child, except one who gave birth to a halfboy. Abu Huraira added: The Prophet (ﷺ) said, "If Solomon had said, "If Allah will" (Allah willing), he would not have been unsuccessful in his action, and would have attained what he had desired." Once Abu Huraira added: Allah apostle said, "If he had accepted."
Reference: Sahih al-Bukhari 6720
In-book reference: Book 84, Hadith 13
USC-MSA web (English) reference(deprecated numbering scheme): Vol. 8, Book 79, Hadith 711