ATF Rul. 2010-6 is also relevant. Key text is as follows.
Held, for the purpose of acquiring firearms under the Gun Control Act of 1968, a United States citizen who temporarily resides in a foreign country, but who also demonstrates the intention of making a home in a particular State, is a resident of the State during the time period he or she actually resides in that State.
Held further, the intention of making a home in a State must be demonstrated to a Federal firearms licensee by presenting valid identification documents. Such documents include, but are not limited to, driver’s licenses, voter registration, tax records, or vehicle registration.
This would take care of military stationed overseas. The full text also discusses multiple state residences which seems to crack the door (in a very grey area, definitely not explicitly stated way) for military firearm purchases in their legal state of residence, assuming they maintain proper documentation for that state.