Yes, but under certain conditions.
Your spouse can benefit from this exemption if the signing of the authentic sale deed occurs within two years of his entry into the nursing home (Article 150 U, II, 1°ter CGI and BOI-RFPI-PVI-10-40-20 §80 and 90).
Other conditions must also be met (income cap, occupation of the property before its sale, nature of the establishment).