This Halacha is an Excerpt from our Sefer
May one take a male child to a women’s beach or vice versa?
Male children in female beach: From the letter of the law, there is no prohibition for male children who are prior to reaching the age of Chinuch, and possibly up until the age of puberty, to visit a female beach [such as with his mother, sister etc]. Nevertheless, practically, one is to be particular to educate his children from a young age in matters of Tznius and Shemiras Eiynayim in order so they abide by these matters when they are older. Many are accustomed to start being careful in this matter from when the son is age 2-3. Some are even accustomed as a Midas Chassidus and an extra act of piety and purity to abstain from bringing male children of any age [even a new born] to a women’s beach in order to guard his eyes in holiness from the time of birth. In fact, the Talmud states that it is for this reason that Hashem made the breasts of a woman by her chest, unlike an animal, in order so the child does not see her Beis Haerva. [Per the Rebbe’s directive of not seeing impure animals starting from birth, this would even more so apply regarding not seeing immodestly dressed women starting from birth.]
Female children to male beach: Female children may not be brought to a male beach starting from age three, when they must follow the laws of modest dress. [If they are dressed appropriately, there is no prohibition for them to be present, although it is improper for them to view men in an immodest state.]
 We do not find mention in Poskim with regards to the age from which a child must be educated not to see women unclothed. Thus, we are left to maintain the general rules of Chinuch, of which for a negative command begins from approximately the age of two-three. [See Admur 343:3 regarding Chinuch for negative commands beginning from the age he understands the words “this is forbidden to do” and this is approximately from age 2-3.] Nevertheless, perhaps regarding these issues of Arayos, we begin from a later age as there is absolutely no Hirhur at this time, just as we find that the Poskim [Rashal Kedushin 22 based on Smag; Dvar Halacha 2:8; Shraga Hameir 8:126; Halichos Bas Yisrael 8:2] rule that children may have Yichud together and do not have to be educated to avoid it until they reach Bar:Bas Mitzvah. Vetzaruch Iyun, as perhaps the same should apply here as well that even after reaching the age of Chinuch from the letter of the law children do not have to be educated in Shemiras Eiynayim. However once a child has reached puberty, or Bar:Bas Mitzvah certainly a prohibition would apply.
 Sefer Chassidim 10 “and not seeing women…one is to educate his children from a young age in order so when he becomes older he not stumble”; Salmas Chaim 689 [Hilchos Harchaka Min Arayos 64]; Mishneh Halachos 12:296
 Chazon Ish [brought in Piskeiy Teshuvos 75:7 footnote 76] states that one is to be careful in this beginning from age 2-3, when the child is already able to remember sights that he sees.
 The reason: As everything a child sees, even from a young age, is encrypted in his mind, and hence it is proper to abstain them from seeing anything which can ignite their Yetzer Hara when they are older. [see Kav Hayashar 2; Hisvadyus 1984 20th MarCheshvan 37 regarding impure animal]
 Brachos 10a; See Torah Leshma 215
 See Rebbe in Sicha ibid who references to Kav Hayashar ibid that one is not to look at impure animals being it becomes encrypted in one’s mind and will affect them when older. Thus, certainly one is to be careful in seeing immodest women, as it will affect them when older. The Rebbe at first states that one is to be careful in this matter beginning from age of Chinuch, and then states that one is to be careful even by a new born, and the Kav Yashar states that the primary cause of making one stumble in looking at women is not being careful in not seeing impure animals. Thus, certainly one should abstain even an infant from seeing immodest women.
 So rule regarding a man praying or learning in presence of a three year old girl who is not modestly dressed: Biur Halacha 75:1 “Tefach Megula” in name of Shulchan Shlomo; Ketzos Hashulchan Vol 1, Haaros Page 90 in name of Chayeh Adam [that from 3 years old a girl is considered an Ervah regarding Shema and Torah learning]; Shut Daas Sofer 1:11; Ben Ish Chaiy Bo 8 brought in Kaf Hachaim 75:10 [concludes to be stringent when possible]; Halichos Shlomo 20:9 in name of Rav SZ”A; Az Nidbaru 13:1; The Rebbe in a letter in Likkutei Sichos [18 p 448] writes that according to Shulchan Aruch the age of Tznius needs to begin at three years old and a day, although one should not be oppressive about this and should speak in a pleasant way. [For a translation of the letter see “Beautiful within” page 39]; See letter of Rav Farkash in “The Jewel of our Crown” page 79; Chesed Lealafim 75:8, brought in Kaf Hachaim 75:10, leaves this matter in question regarding any Ketana; Ashel Avraham of Butchach 75 brings sides to be stringent and lenient in this matter. See Piskeiy Teshuvos 75:8 footnote 82aa
Other opinions: The Chazon Ish [16:9] famously ruled that the laws of modesty for a girl do not begin from age 3 but rather from a later age from when their bodies are developed enough to cause men to have desire for them. [6:7].