“A man will leave his father and mother and be united to his wife and they will become one flesh”- Genesis 2.24
Sex is a part of a relationship. This is evident in the bible and presented as an integral part of marriage. Teaching students about sex and relationships in school is not an assault on spirituality but part of preparing them to enjoy sex in a safe and healthy way.
Deeply religious people can, and should, enjoy sex. Therefore, teens should be educated on matters of sex and relationships as part of their formal education to prepare them to live healthy, well-rounded, spiritual lives. 
Also, the parallels with enforced prayer do not translate. Sex education is also a public health matter. Failure to adequately educate children on matters of sexual health has a direct impact on their wellbeing and the wellbeing of others. It is therefore irresponsible, from a public health perspective, to not teach sex education in schools and ensure all teens and children receive access to the information necessary to protect themselves and their peers.