My dad should have had his done, but was put off by a horror story from one unfortunate person whose ops hadn't gone well.
My brother-in-law had to have one hip done after breaking it when he fell off a ladder. (He had it pinned back together but it never healed properly and went necrotic.) He doesn't cycle, but was walking about on it fairly quickly, and eventually got on with his life, pretty much as before. Unfortunately, he'd been given one of the metal-on-metal ones which are now causing problems -
read this. He is being monitored and will probably have to have a second replacement at some point. They can't keep on doing these operations, so the ideal is to leave them as late as possible so that one or two see you through to the end of your life.
In terms of avoidance ...
My hips were showing signs of wear over 15 years ago. I started taking daily supplements of Glucosamine Sulphate and Cod Liver Oil after reading that they might help. I am fairly convinced that they have since 15 years of extra wear and tear when carrying 3 or 4 stone of surplus weight have not made the hips significantly worse.
Losing weight (if you are overweight) is advisable, to minimise the load that your hips are having to carry.
I find that mashing tough gears on my bike makes my hips ache, so I use very low gears for going up steep climbs.
I used to run, but that was making my hips hurt so I packed it in. Walking and cycling are generally fine.
I found swimming breaststroke uncomfortable - the kick action hurt my hips, so I was avoiding that too.
Read about the potential benefits for bone health of Vitamins A, D3 and K2 with Calcium and Magnesium.