Since it’s an English phrase, it can’t be as old as Biblical times, Gilgamesh, or the Romans.
“to gird one’s loins” dates from 1535. The earliest citation in the OED:
1535 COVERDALE 2 Kings iv. 29 Girde vp thy loynes, and take my staffe in thy hande, and go thy waye. Luke xii.
“gird” means “To surround, encircle (the waist, a person about the waist) with a belt or girdle”