It depends on your particular circumstances. Generally speaking, the court has to reach a fair financial settlement. Whether you can retain the home will usually depend on whether you have children living with you and also what other assets you have between you and your spouse.
The welfare of the children means that they need a home where they can live with the parent who will continue to look after them. If you have enough assets, it may be possible for the children to remain in the family home whilst the other parent buys another property to move into. If there are fewer assets, the home might have to be sold or it might mean that the parent living with the children retains a larger share of the assets than the other parent to allow them to remain in the home. In other cases, a sale of the house might be postponed until a date a few years in the future. It is important, therefore, for you to get legal advice so that you can understand your particular situation.