How to gird your loins:
Girding your loins is something you would find people doing a couple of thousand years ago in Near East Asia and around the Mediterranean just before they attempted anything strenuous and physical such as going into battle. The floor length robes would quite likely get in the way so they would need to be tucked out of the way.
This was accomplished by pulling up the fabric of the knee-length tunic so the length in front stopped at your upper thigh, and collecting the excess material in your front. (You pull the material forward so the back of your tunic is snug against your backside.) Next, you tuck the extra front material down between your legs and gather it behind you. At this point, you collect half of the material behind you evenly on each side of your back (left and right). The final step involves wrapping each side of the material around your waist and tying it together in front.
This gets you ready for battle and the robes are neatly tucked out of the way.
It makes sense from this that the phrase has now come to mean getting yourself prepared for some trial to come.
So there you go.
Now if ever you need to gird your loins you’ll know how it’s done.