All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
If you know that there is impurity in the nappy of the child –and not just doubt about it –then it is not permissible to carry the child in prayer because among the conditions for the validity of the prayer is being pure from any impurities. However, if you do not know about the existence of the impurity in the nappy, then it becomes permissible to carry the child in prayer because it is confirmed that Abu Qataadah said: “The Prophet used to pray while carrying Umaamah Bint Zaynab, and when he would prostrate, he would put her down and when he would stand, he would carry her.” [Al-Bukhari and Muslim]
The fact that in general there is impurity does not affect as long as you are not certain that it exists, in pursuance of the principle which is purity and because this is the predominant case in general.
Ibn Hajar said in Al-Fath when mentioning the benefits of this Hadeeth "The children's clothing and their bodies are believed to be pure unless impurity is confirmed.” He provided this as evidence on favoring acting on the principle in general as indicated by Ash-Shaafi'i . Besides, the author of Awn Al-Ma’bood said: “There is evidence in it that the children's clothing and their bodies are pure unless it is known that they are impure.”
An-Nawawi said the same thing:
“The children's clothing and their bodies are pure and the evidence from the Sharee’ah supports this view.”
Shaykh Ibn 'Uthaymeen said: “It is permissible for a woman to carry her child if he cries while she does not know whether or not there is impurity on him. The evidence about this is that the Prophet did the same thing. He prayed with his granddaughter Umaamah Bint Zaynab, and it is known that in general children’s clothes are often stained with impurity.”
Allaah Knows best.