What is the ruling on an under-five year old child passing in front of a worshipper? If we were to stop him he will insist more on passing, or will sit where we prostrate, or on the worshipper’s head, especially if he is less than three years old.
What you must do is stop him, because of the general meaning of the shar’i evidence concerning that, including the words of the Prophet (peace and blessings of Allaah be upon him): “When one of you prays facing something that is screening him from the people, and someone wants to pass in front of him, let him push him back, and if he insists then let him fight him, for he is no more than a devil.” Agreed upon. What is meant by the phrase “let him fight him” is let him push him back forcefully. And Allaah is the Source of strength. End quote.
Majmoo’ Fataawa Ibn Baaz (29/327).
But if the child is passing frequently and stopping him will distract the worshipper from his prayer, then he should let him be and not focus on preventing him.
Al-Haafiz Ibn Hajar said in Fath al-Baari:
Ibn Battaal and others narrated that there was scholarly consensus that it is not permissible for him to move away from his spot in order to push him away, or to move a great deal in doing so, because that has a greater effect on the prayer than his passing in front of him. End quote.
And Allaah knows best.