He attributed it to the Prophet, who said, Sulayman declared, "Tonight I will go around to ninety wives, and each of them will bear a boy who will fight in the cause of Allah." It was said to him, "Say, 'If Allah wills.'" But he did not say it. He went around to them, yet none of them bore a child except one woman, who gave birth to half a person.The Messenger of Allah ﷺ said, "Had he said, 'If Allah wills,' he would not have broken his oath, and his need would have been fulfilled."
أخبرنا العباس بن عبد العظيم قال حدثنا عبد الرزاق قال أنبأنا معمر عن ابن طاوس عن أبيه
رفعه قال سليمان لأطوفن الليلة على تسعين امرأة تلد كل امرأة منهن غلاما يقاتل في سبيل الله فقيل له قل إن شاء الله فلم يقل فطاف بهن فلم تلد منهن إلا امرأة واحدة نصف إنسان فقال رسول الله ﷺ لو قال إن شاء الله لم يحنث وكان دركا لحاجته
Bukhari narrated it in the Book of Marriage, chapter "A man saying, 'I will surely go around to my wives tonight,'" hadith no. 5242, and Muslim narrated it in the Book of Oaths, chapter on making exceptions in an oath, hadith no. 24/1654, from the hadith of Abdul-Razzaq bin Hammam, through this same chain.