You're either thinking rules under IRC 1031 (which didn't apply to personal residence) or more likely rules under IRC 1033.
If you have an involuntary conversion of property to fire, flood, etc., you generally have a two year window under IRC 1033 to replace the property with similar property to be able to defer the gain. This includes a personal residence; however, it's likely all or most of the gain (up to $500,000 for a married couple) would be excluded, anyway, under the rules noted by others for the general exclusion of gain on sale of primary residence under IRC 121.