Judges 6.
Long story short, the nation fell into sinfulness, so God allowed the Midianites to swarm in and begin to displace Israel. It got so bad the people eventually began to cry out to God. God's response was to send them a prophet who told them what's actually going on.
The beatings will continue until morale improves, in other words.
When enough people have had enough, and give up on flesh efforts to solve things, they will begin to cry out to God. And that's usually when God sends a Messenger to point the way.
That Messenger in this day and age is the Church.