People shrink as they get older because gravity gradually squashes the disks in our spines. As we get older our muscles also weaken so that they cant support our body in as straight and tall a posture.
in addition to Lisa’s answer, we also become shorter during the day when we are on ur feet (again due to gravity). To test this, try measuring your height in the morning when you first get up, and compare this to measuring yourself in the evening. You can expect to have lost a couple of mm which will be regained overnight when you are lying flat.