1) Exercise- weight bearing exercises which promotes bone formation.
2) Life style- don't smoke and don't drink top much alcohol
and then 3), as you were asking about, diet.
Your body needs calcium for healthy bones and needs vit D to help absorb the calcium.
Calcium is found in dairy products, green leafy veg, canned fish with bones and soya products. I think there is some in some dried fruit like apricots too.
Best source of vitamin D is sunlight, so some sun exposure is good. But make sure you stay out of midday sun and use sunscreen to protect from skin cancer.
Food sources of vit D are oily fish and egg yolks.
Another note is to make sure you are in healthy weight range for your body. People who are under weight are much mroe likely to develop osteoporosis.