It is forbidden for a person praying to seat a baby down in front of him because there is concern that the baby will disturb his concentration (Mishnah Berurah 96:4). All the more so, during times of prayer services, one may not bring babies and small children who do not know how to pray, since they are liable to distract the people praying. Although there is an extra pious custom to bring babies to synagogue so that they can absorb the holy atmosphere of the place, that custom refers specifically to times when prayer services are not being held.
In order to emphasize the importance of this matter, I will cite the words of the Shlah HaKadosh who writes in the name of the Orchot Chaim: “Children’s chatter in synagogue is a severe prohibition. Nowadays, their coming to synagogue brings punishment on those who bring them there, for they come to desecrate the holiness of our God’s house and to laugh in it as they do in city streets. They get up to play with one another; this one plays with that one and that one hits the other. One is happy, another crying. One is talking, another screaming. One runs here, the other, there. One relieves himself in the synagogue and everyone screams, ‘Water, water!’ There is one whose father gives him a book and he throws it down on the floor or tears it into twelve different pieces. Consequently, the noise their nonsense produces causes the people praying to lose concentration and results in the desecration of Heaven’s name. Anyone who brings children to synagogue in this way does not deserve to receive a reward for this; instead, he should fear punishment. Worst of all, the children will be raised on this bad custom and foreign habit. As they grow older, they will increase their contempt for the synagogue and its sanctity, and they will show no respect for the Torah. Additionally, when a person repeatedly sins, [in his eyes] the sin becomes permitted. Therefore, when he ages, he will not abandon his ways. In conclusion, it is proper for a person not to bring very small children to synagogue, because he will [only] lose from it and not gain. However, when the child reaches the age of understanding, on the contrary; the father must bring the child to synagogue, teach him to sit in awe and fear, not let him move from his seat, and instruct him to answer Amen and [respond to] Kaddish and Kedushah” (Shnei Luchot HaBrit, Masechet Tamid Ner Mitzvah, also brought briefly by Mishnah Berurah 98:3).
One whose child begins to disrupt the congregation’s prayer must take him by the hand, bring him outside, and continue to pray there, even if he is in the middle of reciting the Amidah (see further in this book 17:15).