The best time to apply for Medicare is during your Initial Enrollment Period unless you have coverage through your employer. This period starts three months before your 65th birthday month and ends three months after your 65th birthday month.
If you have health coverage through your employer or your spouse's employer, you can qualify for a Special Enrollment Period that starts the month after you end your employment. This period lasts eight months, and you won't have to worry about late enrollment penalties.