There is not a black and white answer to this question. It depends on a lot of factors. If there are minor children, usually the court will allow the parent with primary custody to live in the house with the children during the separation.
In the past, the party living in the house with the children, usually the mother, asked the court to have the other party, usually the father, pay the mortgage during the separation. The payment of the mortgage was in addition to child support and spousal support. Some courts would order the mortgage paid by the husband, especially if the mother had no job. Others would divide the mortgage in two or deduct the rental value of the house from the amount of the mortgage, charge the person living in the house with the rental value, and divide the remaining amount either equally or in proportion to the parties’ income.
These days, an order for payment of the mortgage often depends on whether or not there is any equity in the house. Most divorcing couples don’t have any equity in the house so the court is not charged with preserving the asset during the separation period so it can be divided later. Often the court won’t even divide the deficiency or upside part of the house in the divorce as that can possibly prevent one of the parties from discharging the debt in bankruptcy later.
If there are no children, it is more difficult to decide who lives in the house. The court will not kick out a spouse if you are still together unless there has been domestic violence in which case the one attacked can get a protective order forcing the other spouse to leave. Short of violence, each spouse has the right to live in the house and the court won’t make either one of them go unless there are fault grounds causing the divorce like adultery in which case the court will often order the cheating spouse to leave (but not always, especially if there are children involved). Who gets the house during the separation depends on your particular situation.