Capital Gain Tax on Sale of the House

My fiancé lived in my house for over 8 years (in California, I am the owner). We are planning to sell it this year. Will we qualify for the $500,000 exclusion on the capital gain if we get married during this year? Or do you need to be married for certain amount of time to be able to exclude $500,000 as a married couple? 

Thank you!