They insure the banks against mortgage default. People pay a small premium on their monthly mortgage payments so that if they default, the bank is insured for the cash difference of the outstanding amount on the mortgage.
As a result, banks in Canada face no risks from mortgage default so there's no reason to deny a mortgage. Over 90% of mortgages made in the past decade are CMHC-insured.