The molestation backstory was the entire crux of the ending of the film, in two specific ways.
First of all, Casey's inability to pull the trigger on her uncle when she had the chance as a child has haunted her her whole life. As shown and implied throughout the film, she's withdrawn, depressed, and scared to take action to protect herself (refusing to help the other two girls in the beginning). Her growth as a character came full circle when she grabbed the shotgun on the end and was finally ready to pull the trigger. This was her breaking free of her abusive upbringing & moving on. That's why it's implied at the end that she won't be going back home with her uncle.
Second, her abuse and molestation as a child also led to cutting that was revealed when she finally took off her sweater at the end & showed her arms. This is what saved her life, as The Beast sees those that have gone through struggle and abuse, as he did, as "Pure". He spared her life because she had gone through pain, just as he did. McAvoy's character was originally only going to abduct the other two girls for sacrifice, but Casey tagged along at the last second because she needed a ride home. That's why he didn't immediately knock her out in the car. It's safe to assume that McAvoy's character stalked and researched the other two girls to make sure they were "impure" and never had any major pain in their lives, but Casey was an unknown to him.