Is it legal to transfer your mortgage to your family member?

It depends, and if ever it is possible the family member that you would transfer your mortgage to, would be liable for the repayment of the debt of your mortgage.