Well not that I see much reason for the law but they did it for General Marshall in 1950.
Mattis wouldn’t be the first defense secretary to require a congressional waiver. President Harry Truman appointed Gen. George Marshall to the position in 1950, nearly five years after he retired from the Army. Congress granted the waiver (at the time, the interval between active duty and defense secretary service was 10 years).
http://www.cnn.com/2016/11/21/politics/james-mattis-defense-secretary-waiver/
Now that is an interesting parallel. A “Marshall Plan” to restore and to rebuild America after WW Obama.
And CNN is never wrong?
Here's the law in question: 10 U.S. Code § 113 Nothing in it about waivers.
Regardless of how they do it, Mattis will be Secretary of Defense.