It’s not a question of being legal or illegal, it’s a question of whether or not you have the right under the law. As a general rule, neither party can be removed from the marital home during the litigation; unless a court authorizes it, or unless you move out voluntarily. A court will not remove someone from their marital home, unless they believe they’re a danger to the other people in the house or if they’ve committed acts of violence. Violence will get you removed from the house. But if both of you own the house or both were in residence in the house and people are not hurting each other, the court will allow both of you; not withstanding how unpleasant it is, to remain in the house until there is a final determination.