According to the current tax law, "Taxpayers can exclude up to $250,000 in profit from the sale of a main home (or $500,000 for a married couple) as long as they have owned the home and lived in the home for a minimum of two years. Also, those two years do not need to be consecutive." The IRS has stated that "in the 5 years prior to the sale of the house, the taxpayer needed to have lived in the house for at least 24 months in that 5-year period.
In other words, the home must have been your principal residence. Taxpayers may use this 2-out-of-5 year rule to exclude their profits each time they sell or exchange your main home. Thus, it seems that you have clearly satisfied the 2 out of the last 5 years of the test!
To answer your other question regarding a special treatment for the US Military, President Bush had signed into law the Military Family Tax Relief Act of 2003. Within the provisions of this particular law, “a taxpayer, who is in the Military, and was on a qualified official extended duty in the U.S. Armed Services or the Foreign Service, may suspend for up to 10 years of such duty time the running of the 5-year ownership-and-use period before the sale of a residence.”
This means that Military Personnel receive favorable tax treatment with respect to the “Gain on the Sale of the Principal Residence” in that instead of having to meet the 2 out 5 years rule to exclude their profits each time they sell or exchange their main home, they are allowed to use 2 out 10 years.