There's laws in my state that says you can't water your horse in the public square. That doesn't mean that law is either right or relevant. Sometimes laws (and we have WAY too many of them already) are either poorly written, poorly enforced or just past their point of relevance from when they were enacted.
I can promise you, in 1780, there was no law about 17 year-olds having sex with 24 year-olds.
Arguing rather a law is either right or relevent is not relevent in this case. The law exists and she broke it.