Social Security benefits are generally not payable for months that you are confined to a jail, prison or certain other public institutions for commission of a crime. 

If you are receiving SSDI, your benefits will be suspended if you are admitted for more than 30 continuous days to a jail or prison because you were convicted of a criminal offense. However, auxiliary benefits to your children or your spouse will continue as long as they remain eligible. Your benefits can be reinstated starting with the month following the month you are released. You will need to provide SSA with a copy of your release documents.

Your eligibility for Medicare Part A (hospital insurance) continues uninterrupted while you are in prison. However, Medicare Part B (medical insurance) will terminate if you do not pay your monthly premiums while you are in prison.

If you are receiving SSI, your payments are suspended while you are in prison. Your payments can be reinstated in the month you are released. You will need to provide SSA with a copy of your release documents. However, if your confinement lasts for 12 consecutive months or longer, your eligibility for SSI benefits will terminate and you must file a new application for benefits.