The Prophet ﷺ said, "Sulayman bin Dawud, the prophet of Allah, said, 'Tonight I will go around to seventy wives, each of whom will bear a son who will fight in the path of Allah.'His companion, or the angel, said to him, 'Say, If Allah wills.'But he did not say it and forgot. None of his wives became pregnant except one, who delivered half a child."The Messenger of Allah ﷺ said, "Had he said, 'If Allah wills,' he would not have broken his oath, and it would have helped him achieve what he wanted."In another narration, "Had he made the exception."
عن النبي ﷺ قال: قال سليمان بن داود نبي الله: لأطوفن الليلة على سبعين امرأة، كلهن تأتي بغلام يقاتل في سبيل الله، فقال له صاحبه أو الملك: قل: إن شاء الله، فلم يقل ونسي، فلم تأت واحدة من نسائه إلا واحدة جاءت بشق غلام، فقال رسول الله ﷺ: لو قال: إن شاء الله لم يحنث، وكان دركا له في حاجته وفي رواية: لو كان استثنى
Bukhari narrated it in the Book of Expiation for Oaths (6720), and Muslim in the Book of Oaths and Vows (1654:23), both through the route of Sufyan, from Hisham bin Hujayr, from Tawus, from Abu Hurairah, who narrated it. The wording given is Muslim's.The other narration, also Muslim's (1654:22), comes through the route of Ayub, from Muhammad (that is, Ibn Sirin), from Abu Hurairah, and Bukhari cited it as a suspended narration following Tawus's narration.As for Sulayman's statement, "I will surely go around tonight to seventy...", perhaps he said that only once, for otherwise Sulayman had children, some of whom took over rule after him, such as Rehoboam, who established the kingdom of Judah, and Jeroboam, who established the kingdom of Israel. See the details of that in my book, Studies in Judaism, Christianity, and the Religions of Hind (p. 110).