You will automatically be enrolled in Medicare when you turn 65. I am assuming you mean a Medicare Supplement or Medicare Advantage Plan. While there a number of ways to purchase Medicare Supplement Insurance on-line, I would sit down with a good local independent agent who specializes in Medicare plans. A good experienced agent will explain your options and help you find the plan that is right for you.
You can enroll in Medicare at age 65 if you have at least 10 years in the Social Security system as a wage earner, are a US citizen or legal resident and have lived in the US at least 5 years.
If you do not have SS wages you may qualify from your spouse's earnings.
If you do not have SS wages you may qualify from your spouse's earnings.