Ibn Abbas (may Allah be pleased with them both) narrated that Sa'b bin Jaththamah (may Allah be pleased with him) informed me that he heard the Prophet ﷺ being asked about the ruling concerning the families of the polytheists when a night raid is carried out against them and small children and women are also affected by it. The Messenger of Allah ﷺ replied: "They are from among them." Amr bin Dinar narrated from Zuhri with these additional words: "They are from among their fathers." (Meaning, they belong to the same lineage.)
Hadith Referenceمسند الإمام الشافعي / كتاب الجهاد وقسم الغنائم / 1736
Hadith Takhrijاخرجه البخارى الجهاد والسير باب اهل الدار يبتون فيصاب الولدان والذارى (3012)، (3013)۔ ومسلم، الجهاد، باب جواز قتل النساء والصبيان في البيات من غير عمد (1745)۔