Replacement cost depends on the vehicle and how many bearings are replaced. KBB puts the cost at about $350 for a bad wheel bearing, but the figure can swing widely. Luxury cars such as BMW or Audi use more expensive parts. As an example, a shop quoted about $1,000 to replace all four bearings on an E46 BMW M3. Costs are generally lower on more affordable used cars: KBB estimates roughly $500 for repairs on a 2012 Honda Civic.
If one bearing fails, the others are not far behind, so consider that when budgeting. DIY replacement can be cheaper, but only if you have the tools and some experience. Do not attempt it if you are not a somewhat experienced mechanic; specific torque specifications must be followed. If you do not know what that means, use a mechanic.
For a 2012 Civic, the bearing itself is about $114, so a DIY owner could replace all four for roughly the cost of having one done. Any excessive noise, grinding or poor handling means the wheel bearings should be examined.