Elasticated waistbands, whether on formal or casual trousers, joggers, shorts or pyjamas can have an annoying, and uncomfortable, habit of twisting. This is an easy one to fix to get the elastic back under control. And get wearing again!
If you have no access to a sewing machine you can hand stitch from top to bottom on the side seams and front and back seams. Stitch through all of the layers. These rows of stitching will secure the elastic in place and they will not be seen.
On the sewing machine start with the needle in the waistband (or it will ping away from you). Pull the elastic flat and stitch through the layers. Make sure you hold the waistband with your left hand and pull the elasticated waistband with the other hand as you stitch. One row of stitching will hold everything in place or you can do more rows for a more decorative finish. I’ve saved many elasticated waists on the various garments over the years using this technique.