How does sleep affect bone density? This review from Metabolism covers the basics of the circadian rhythm and its affect on bone health.
Your circadian rhythm is the natural, internal schedule that your body takes on. This "internal clock" affects your sleep cycle, wakefulness, hormone production, digestion, body temperature and so much more, including bone health.
But how does it specifically impact bone health? Throughout the day, your bones are always in flux, changing ever so slightly based off of the natural cycle in your body. Yet, as this review indicates, bone turnover markers (specific proteins that affect bone formation) follow your circadian rhythm, increasing in production overnight and peaking in the early hours of the morning. This specific timing is unrelated to your sex, age, or menopausal status. Yet, it is affected by both the when and how long you sleep.
If you don't or can't have a consistent sleep schedule, your bone density can be affected. The article cites studies done on shift workers, indicating that people who have to work night shifts had lower bone density and were more likely to report fractures.
While sometimes getting a good night of sleep seems impossible, there are other lifestyle factors that you can change to improve your bone health. These include exercise, nutrition, and taking medications if indicated by your doctor.