You should sit with your legs together when you're sitting on the train with a skirt on, otherwise people can see inside your skirt.
You should keep your knees together when you
ーYou should sit with your legs together when you're sitting on the train with a skirt on, otherwise people can see inside your skirt.
「スカートをはいて電車で座る時は、足を閉じて座りなさい。そうしないとスカートの中を見られますよ」
to sit with one's legs together で「足を閉じて座る」
people can see inside your skirt で「みんなあなたのスカートの中を見ることができる」=「スカートの中を見られる」
You should keep your knees together when you're sitting on the train with a skirt on.
のように to keep one's knees together で「膝を閉じておく」とも言えます。
ご参考まで!