Generally, when two people purchase property together neither are thinking about what will become of it if they separate. This can become a major problem if such a situation arises, but there are steps that can be taken to guard against excessive losses. While forming a contingency plan for the end of any kind of partnership may not be pleasant, partition actions are for the good of both parties.
Documentation of all expenses related to a purchase, and the amount each party contributed, is essential for planning, as well as resolution of any eventualities. This way, accurate reimbursements can be agreed upon with minimal dispute.
When worst does come to worst, the most common remedy is mediation. It is a standard first step in dispute resolution and tends to be highly effective, particularly in partition. That said, it can still be expensive, certainly much more so than a well made separation plan.