When you and your spouse are dividing assets in a divorce, your vehicles are likely not among your primary concerns. Likely, you've got assets worth far more. However, if you agreed to cosign on a car loan for your spouse or your spouse did that for you, you probably don't want to continue to have your names on that loan together.
Your spouse may keep the car (particularly if they were the primary signer) and agree to make the loan payments. However, if they decide to stop making them or are late with a payment, your credit rating could be impacted. You may not even be aware that your ex wasn't making payments until you start getting collection agency calls.
Even if the divorce agreement stipulates that your spouse is responsible for the payments, that won't matter to the creditor. As far as they're concerned, you still have responsibility for it if your name is on the loan.
One way to avoid a problem is to pay off the loan as part of the divorce settlement, with one of you keeping the vehicle. It's best to get your name off the title if you're not the one keeping it.
You may opt to sell the car to another buyer. If you're lucky, the car is worth enough to cover the balance of the loan.
If one of you wants to keep the car and take over responsibility for the remainder of the loan, that person can refinance the loan alone (or with someone else's help).
Depending on the terms of the loan, the cosigner may be able to get out of their obligation if the primary borrower has made a specified number of payments on their own and on time. If there's a cosigner release option, it will be noted in your loan documents. You can also check with your lender.
If you're in this situation, regardless of whether you're the cosigner or your spouse is, you'll need to determine what your best option is. Your family law attorney can advise you how best to work out the division of this asset.