There are three (3) scenarios possible here, and the answer varies slightly for each.
Rental Property to Primary Residence
An investor acquires rental property and rents it out for any length of time (it was not acquired as part of a 1031 exchange). The investor could sell and complete a 1031 exchange into another rental property, or the investor could move into the property, convert it to his/her primary residence, live in it for 24 months (minimum) and then sell and take advantage of the 121 exclusion pursuant to Section 121 of the Internal Revenue Code. The 121 exclusion is the $250/$500K tax-free exclusion available on the sale of a primary residence. This strategy would only exclude any capital gain up to the $250/$500K limitation and any depreciation recapture would be recognized.
1031 Exchange into Rental Property and then to Primary Residence
An investor owns rental property that he/she sells and 1031 exchanges into other rental property and after renting the newly acquired rental property for 12 to 18 months (in order to demonstate intent to hold for investment) converts it to his/her primary residence by moving into it and lives in it for 24 months (minimum, in order to satisfy the 121 exclusion requirements of living in it as a primary residence for 24 months out of the last 60 months).
This transaction is identical to the first one with the exception that it started off as part of a 1031 exchange, and because the property that was converted to his/her primary residence was originally acquired as replacement property in a prior 1031 exchange the investor must own it for at least five (5) years before he/she can sell and take advantage of the 121 exclusion. The five (5) year ownership (holding) requirement is a new requirement contained in the October 2004 income tax act.
So, to summarize, under this structure the investor would sell and exchange into new rental property, rent for 12 to 18 months, convert it to his/her primary residence, live in it for at least 24 months, and once he/she has owned it for a total of five (5) years he/she could sell the property and take advantage of the 121 exclusion. This strategy would also only exclude any capital gain up to the $250/$500K limitation and any depreciation recapture would be recognized. If the property has a lot of built up depreciation this strategy may not be appropriate for the investor.
Primary Residence to Rental Property
This is perhaps the best yet. The IRS issued Revenue Procedure 2005-14 that allows an investor to convert his/her primary residence into investment property and ultimately take advantage of both the 121 tax-free exclusion up to the limits of $250K/$500K AND defer the rest of their capital gain by using a 1031 exchange.
The steps would be to move out of the primary residence and rent it out for 12 to 18 months in order to demonstrate intent to hold for investment and then sell the property. As long as the investor has owned and lived in the property as his/her primary residence for at least 24 months out of the last 60 months he/she will qualify for the 121 exclusion. And, as long as the property has been held as investment property for a period long enough to demonstrate intent to hold and is investment property at the date of sale the investor can complete a 1031 exchange and defer the balance of his/her capital gain income tax liabilities.
Whew! Does any of that make sense?