They crossed the line. One too many times, the Israelites provoked God. After He showed them His goodness by giving them food and water and delivering them powerfully from the Egyptians, they accused Him of being bad. They complained that it would have been better to die wandering in the desert than die by the sword taking possession of the Promised Land.
So God let that be a self-fulfilled prophecy. A generation died in the desert. Forty years later, the next generation of Israelites rose up and possessed the Promised Land under Joshua’s leadership.
That generation was too accustomed to a mouth that constantly b-tch-d — mmm, complained bitterly.
If you dig in your heels and insist on sinning, the consequences could be grave.