Also note that people who are in the US on nonimmigrant visas still have to pay SSDI taxes, even though they are ineligible for the benefits. (Though they get to count them towards the time needed for sponsorship if they become immigrants.)
Depending on the state non-immigrants may be eligible if they've paid into the system as generally the state benefits are for state residents, a status that even as a non-immigrant you qualify for.
However most visa categories require you to leave the US within ten days if you no longer meet the visa requirements. So it's difficult to claim said benefits without messing up your future immigration chances.