Does it matter if I moved out before the divorce? If I do, isn't that abandonment?

Whether and when to separate is an important decision that should be made in consultation with counsel.  

Moving out of the home--especially when minor children are involved--can affect your case and how much time you ultimately get with the children. I know it's a nightmare to live together when you're fighting, and I can usually take steps to get parties separated, but the separation should be managed to protect your rights.  

You will not be prosecuted for abandonment if your separation and the parents' rights and responsibilities are handled through the court. 

Domestic violence changes everything.  f there's any violence, or any threats of violence, or even any allegations of violence, you should work with the police and counsel to ensure your safety.