If you are age 55 or over, you are also eligible the make a "catch-up" contribution, which increases your annual contribution limit. That extra amount is $1,000 in 2017.
Once you enroll in Medicare however, you are no longer eligible to make contributions to an HSA. Your annual contribution limit during the year in which you enroll will be prorated to include only the months during which you are not enrolled in Medicare. Most people become eligible for Medicare benefits on the first day of the month they turn 65.
Medicare enrollment in ANY part of Medicare disqualifies ongoing contributions to an HSA. The below links provide helpful information about the enrollment process, including when automatic enrollment could occur for those receiving social security benefits already, how to opt-out, and the special enrollment period for people still working that helps avoid any penalties or premium increases when enrollment is deferred.
Here are helpful links regarding Medicare coverage and enrollment: