Save up a big fat pile of money before you retire. Sadly, we're not joking.
Sure, once you hit 65 you will be eligible for Medicare. That will take care of a lot of your medical expenses, but probably not all. You will be required to pay a premium for some of your Medicare coverage, and you will probably want to purchase a private Medigap policy to cover all the costs that Medicare doesn't.
And be careful about relying on your employer's promise to provide health care benefits once you retire. Even those that pledge such care may find it hard to live up to their promise when you hit retirement. Many big companies in a financial pinch are reducing or rescinding health insurance benefits once promised to their retirees.
With that said, if your employer lays you off or offers you an early retirement package before you turn 65, negotiate hard to keep your health benefits as long as possible. It's easy to get worked up about getting more pay added to your package, but extended health coverage can be an even more lucrative benefit. So try to get that if you can.
Finally, assuming you had insurance in your former job, you should be able to temporarily continue those benefits under COBRA, or the The Consolidated Omnibus Budget Reconciliation Act, for up to 18 months after you lose a job, if you work for a company with 20 or more employees. At that point, if you’re not old enough to qualify for Medicare, you’re on your own. The good news is that under the Affordable Care Act, you can’t be turned down for an individual policy for age or health reasons. But that doesn’t mean a policy will be cheap, and some with lower premiums may come with large deductibles and other out of pocket costs.