A former Western Harnett High School teacher has been charged with having sex with one of his students, officials said Tuesday.