"God chastises those He loves. Adversity is beloved since it is purifying, just as sacrifices are. Regarding sacrifices it is written (Leviticus 1:4) 'and it shall be accepted for him to atone for him'. Regarding adversity it is written (Proverbs 3:12) 'for whom the Lord loves, He admonishes'. Furthermore, adversity is even more beloved than sacrifices, as sin offerings and guilt offerings only atone for specific sins, as it is written 'and it shall be accepted for him to atone for him'. But adversity atones for everything. 'God, chastise me in Your discipline.'"
Why God Disciplines Those He Loves the Most
Midrash Tehillim 118:15