I have a feeling if they worked here legally, did every thing legally they already get Medicare and Social Security checks when they retire. I know they get Medicare ---- there are many living in Mexico who come over with Medicare numbers ---- because they worked and retired here.
I did some reading on this recently. It seems that what matters is the worker's status at the time benefits are applied for, not their status at the time of employment. From Congressional testimony by Barbara Bovbjerg, a GAO manager:
You are required under the law from the Welfare Reform Act of '96 to be legally present to get benefits here. How you earn those benefits is not relevant to the Social Security Administration's work. If you earned them legally or illegally and you are legally present, you will be paid those benefits. If you are not legally present, you can get them if you are a Mexican citizen in Mexico. Source
Also, she states in the same hearings on page 30 that there are 50,000 living in Mexico that currently receive Social Security benefits.