The drawstring has disappeared into the waistband channel
Short answer: Pin a safety pin to the end of the cord and feed it back through the channel. Then sew a couple of stitches at each end so it does not happen again.
Why it happens
The cord is held in place by friction alone. Once the fabric has been washed a few times and the channel gets smoother, the cord slips in easily and one firm pull is enough. It happens most often in sleep trousers and joggers where the cord is used daily.
How to get it back out
Attach a large safety pin to the end of the cord, feed the pin into the opening and push it along the channel while gathering the fabric ahead of it. If there is nothing to attach to, tie a thin thread around the end and pull it through. Take your time, because a hard tug tears the channel open.
When both ends have vanished
Never cut into the channel. Find the side seam of the waistband, unpick a few stitches carefully and pull the cord out there. Sew the seam closed afterwards. See bamboo sleep trousers for women and sleep trousers for men.
How to prevent it
Sew a single stitch through cord and channel at the centre back so the cord cannot travel. Tie a small knot at each end that cannot pass through the opening. See bamboo jogging sets for men.
Frequently asked questions
Can a worn cord be replaced
Yes. Tie the new cord to the old one and pull the old one out, and the new one follows.
Why does it happen more after many washes
Because the fabric softens and the channel gets smoother, so the friction that held the cord disappears.
Is elastic better than a drawstring
For nightwear often yes, but a cord gives more precise adjustment at the waist.