Just another ground for the rear of the transmission. If it had been pulled, the xfer pulled, or any number of other reasons it could have been disconnected. All of the circuits for the CDL have their own dedicated grounds, and even if they didn't they could probably ground through the engine ground wires and work just fine. Not engaging your CDL should have no impact on this wire somehow becoming unbolted.
Just bolt it back up. There is a 6mm stud sticking out from the bottom of the trans tunnel that it goes onto. If some mechanic left this loose on accident in years past the nut may still be sitting on the stud. (heh)