Many divorces are relatively amicable and the two adults involved are able to work together well enough to come up with solutions that suit both of them and are able to co-parent together, if necessary. However, there are some divorces that are much more contentious, especially if there have already been instances of domestic violence in any form. If you are filing for divorce because you have been the victim of DV, one of the things that you can do is to ask your family attorney to help you file for a restraining order.
A restraining order is a legal document that requires the person who it has been filed against to stay X distance from the person holding the order. That distance could be anywhere from 50 feet to even further, depending on the request and the judge. There are also other things that can be added to the RO, including things like not being able to contact the person by phone or email or having to stay away from the schools or workplaces of children. The way that it would work is that you would go to your lawyer, and they could help you fill out all the necessary paperwork, including all pertinent evidence, and then you two would go to court. The judge would then talk to you and your lawyer, and if/when they grant the restraining order, it can then be served to the necessary parties. You can set it up so that the restraining order is filed at the same time as the divorce, or it can happen at any point after that. There are several reasons to file a restraining order.
One reason is that it will start a paper trail, or add to an existing one, showing what your soon-to-be ex has done in the past. Having the restraining order, whether it's a temporary or a permanent one, will give the police a reason to be able to arrest your former spouse if they violate it, where they might not have a reason to if the other person has just shown up to your house and started yelling at you.
If you are filing for divorce and it is very contentious and/or there have been incidents of DV, your attorney can help you to file for a restraining order. The order is designed to keep your former spouse from talking to you or seeing you.