Home sale and interstate move.
You do not qualify to exclude the gain on the sale. To exclude gain on the sale of your home, you must have owned and lived in the property as your main home for at least 2 years during the 5-year period ending on the date of sale.
If you asked whether the move qualifies as a change in place of employment so that you can deduct moving expenses, you probably can.
Your spouse can deduct moving expenses if your spouse meets the distance test and the time test.
The move will meet the distance test if the new main job location is at least 50 miles farther from the former home than the old main job location was from the former home. For example, if your old main job was 3 miles from the former home, the new main job must be at least 53 miles from that former home. If you are moving to another state, that will qualify.
Under the time test, an employee, must work full time for at least 39 weeks during the first 12 months after arriving in the general area of the new job location. For this time test, count only full-time work as an employee. Your spouse does not have to work for the same employer for the 39 weeks. There is no need to work 39 weeks in a row. However, your spouse must work full time within the same general commuting area.