Until what ages can girls swim with boys (for non-relatives as well as brothers & sisters)?
The problem associated with “mixed swimming” is the question of immodestly dressed girls in front of boys (added to the general issue of boys and girls mingling).
A girl must not swim with boys from the age that she is considered an erva. There is a dispute among poskim as to when whether this implies a specific age or not. Some say that the halachah applies from as young as three years old (see Salmas Chaim, 4:1; Teshuvos Vehanhagos 1:137), but others, (based primarily on Chazon Ish, Orach Chaim 16:8) write that there is no set age, and the question of erva depends on the general appearance of the girl. Therefore, certainly from the age of 7-8 (the age generally accepted according to the above position of Chazon Ish) a girl should not go swimming with boys.
Concerning boys going swimming with girls, some are particular from the age of three (see Halichos Bas Yisrael 7:19), , as part of the obligation of chinuch, and others have written to be particular from even younger (!) (see Teshuvos Vahanhagos, ibid). However, in practice many are lenient until a little later (no set age is given), and certainly one should be stringent from the age of six.
For brothers and sisters, some apply the same principles as for non-family members, but others are lenient (see sourced cited in post entitled “sister’s singing” here), and girls aged 11/12 must be covered in front of their brothers (see Toras Hahistaklus 14:20; Tahras Einayim p. 21-22; Aderes Tiferes siman 35 at length).