Rabbi Isaiah ben Abraham Halevi Hurwitz, better known as the Holy Shelah, cites a ruling against bringing small children to the synagogue if they have not yet learned how to behave there with due respect.
The presence of small children, who innocently play or disturb their parents and other worshippers, can be a source of serious distraction during worship.
However important it may be, educationally, for children to visit the synagogue and to feel a sense of identification with it, care must be taken that this be done in such a way as to inculcate a proper attitude of respect.
When the worshipper in the synagogue is forced, for family reasons, to act also as a baby-sitter, he becomes a hindrance to both himself and others.
An awareness of the dignity of the synagogue and an attitude of an inner feeling of “Temple-like awe” toward it are in themselves an important means of attaining a closer, heartfelt relationship with God through the prayer recited in the synagogue.
–Rabbi Adin Steinsaltz