Swinging and aviation date back to the mid 1900s where it is alleged to have been a common practice in the US Air force before pilots deployed overseas. Later on, the large military bases which enabled families to accompany serving personnel on deployments made things easier. Supposedly it helped bonding in the unit and implied that families would be taken care of if husbands were lost in combat.
These two Captains were simply carrying on with aviation tradition.