Deductions & credits

In your example, you can use the exclusion for the home you owned before you were married, if you otherwise qualify.  If your spouse sells a home he owned before he was married, they can take their separate exclusion on that home.

Then, your next opportunity to use the exclusion would be at least 2 years from the latest usage of the exclusion by either one of you.