Police officer charged, accused having sex with prisoner