Legally you are not entitled by law to change the locks with the express purpose of locking your spouse out of the home. Your spouse shares an equal right to possession of the home with you and has a right to be in the home.
Practically however, anyone can call a locksmith and ask them to change the locks on their own property. The probable outcome of such an action is that your spouse will turn around and do the exact same thing and a lock changing war can result. This type of battle is immature and will not result in benefits to anyone.
Once a separation agreement or court order is in place, it should deal with who has the right to be in the home when and if your spouse no longer has that right, then you can change the locks.