You have a few options in case of separation or divorce.
If neither person wants to keep the property, you can sell it and share the profits according to the separation or divorce agreement.
If one person wants to keep the home, they can buy the other person out. If the person keeping the home is approved for financing, they must sign a new deed with a notary so the mortgage is in their name only.
In both cases, you may need to pay prepayment charges. Contact your mortgage advisor to discuss your specific situation.