The Messenger of Allah ﷺ said, "Every newborn is born upon the natural disposition. It is the parents who turn the child into a Jew or a Christian, just as livestock produce their young intact. Do you find any of them mutilated before you yourselves mutilate them?"They asked, "Messenger of Allah, what do you say about one who dies as a young child?"He replied, "Allah knows best what they would have done."
قال رسول الله ﷺ: ما من مولود إلا يولد على الفطرة، فأبواه يهودانه، وينصرانه، كما تنتجون البهيمة هل تجدون فيها من جدعاء حتى تكونوا أنتم تجدعونها؟ قالوا: يا رسول الله، أفرأيت من يموت وهو صغير؟ قال: الله أعلم بما كانوا عاملين.
Bukhari narrated it in the Chapter on Divine Decree (6599), and Muslim in the Chapter on Divine Decree (2658, 24), both from the hadith of Abdul-Razzaq, from Mamar, from Hammam bin Munabbih, who said, "This is what Abu Hurairah narrated to us, from the Messenger of Allahﷺ," then he mentioned several hadiths, including this one.The meaning of the hadith, as Hammad bin Salama said, is, "This, in our view, refers to when Allah took the covenant from them in the loins of their fathers, when He said, "Am I not your Lord? They said, Yes" [Araf 7:172]."Abu Dawud reported it (4716) with his chain of transmission from him, and Khattabi endorsed this meaning as good, saying, "The meaning of Hammad's statement here is good. It seems he held the view that innate faith carries no weight in the rulings of this world, and that what counts is the faith acquired through the sacred law by will and action. Do you not see that he says, 'His parents make him a Jew or a Christian,' meaning that despite the presence of innate faith within him, he is given the ruling of his two disbelieving parents?" End of quote.See Qada wal-Qadar by Bayhaqi (3/871).