An Alabama judge ruled that a state law that criminalizes high school teachers having sex with students is unconstitutional and dismissed charges in two cases.