Yes, in some circumstances. In Ontario, if you and your ex have a home that is jointly-owned, then the Partition Act allows either of you to apply for a court order mandating the sale of the home. The court will order your jointly-owned home to be listed on the open market, with the goal that it attracts the highest possible selling price.
The situation involving a forced partition-and-sale (as it is known) will usually arise where you and your ex cannot agree on how to deal with the property in your upcoming divorce proceedings. In such scenarios, neither you or your ex have a “right of first refusal” to buy the matrimonial home from the other.
If your matrimonial home is not jointly-owned, then the Partition Act does not apply. Instead, you and your ex will have to sort out your respective claims to the property through the usual equalization process set up under the Ontario Family Law Act.