The locks on what?
If you and your spouse own a house together, and no court has made an order giving one of you EXCLUSIVE use and possession, then you're each still entitled to use and possession. This means either of you can change the locks, and the other one can then come back with a locksmith and change them back, or change them again. You can both keep doing this until there's a fistfight and the police show up.
You should speak to an experienced family law lawyer, and figure out your EFFECTIVE remedies, rather than trying to "self-help" this way.
There is nothing illegal about changing the locks, but you should not destroy, sell, or get rid of any of your spouse's belongings. Furthermore, you should file for divorce or legal separation immediately and request sole and exclusive use of the house. This will officially give you the legal right to live there and take away your spouse's current equal right to live there.
Sign up to receive a 10-part series of useful information and legal advice about the divorce process.