As covered above, withdrawing your RRSP early before retirement can have costly tax implications - with two notable exceptions:
Home Buyers' Plan: you can withdraw up to $35,000 from your RRSP to put towards your first-time home purchase (if you're buying with someone else, you can each withdraw $35,000 for a combined total of $70,000)
Lifelong Learning Plan: withdraw up to $10,000 in a calendar year (up to $20,000 in total) for advanced adult education for you, your spouse, or your common-law partner.
Under these two programs, you can withdraw your RRSP before retirement with no penalties.
However, these withdrawals are considered to be loans and must be contributed back into your RRSP over a specific period. For instance, as part of the Home Buyers' Plan, you must refund the amount you withdrew over 15 years starting two years after your home purchase. If you withdrew the full amount ($35,000), you would need to contribute roughly $2,333 back into your RRSP every year.