Thanks for the chance to help. I am an attorney with over 12 years experience. Hopefully I can help you with your legal question.
What you describe is certainly possible, if he agrees. That is, if you plan to divorce and there is equity in the home, typically you and he would split that equity...but if you come to some agreement, where both of you agree how to split that equity, the court will approve that in the divorce decree.
The key is the agreement.
If you can not agree? Then you would need to hire a lawyer, and allow the lawyer to present evidence to the court on how the assets of the marriage
would be divided.
So it certainly is a good idea to "agree" if you can...save you both lawyer fees.
Of course, if he wants to keep the home, and if you agree to let him "buy you out", the loan would still be in both your names until he is able to refinance in his name alone. If that is not an issue (if he can qualify for a loan on his own) then this is certainly something that can be done.
Otherwise you would likely need to sell the home to pull out the equity.
Let me know if you have more questions