Increasing evidence suggests that incarceration can improve the social reintegration of inmates in some circumstances. Yet, the mechanisms through which incarceration may favor rehabilitation remain unknown. This paper exploits variations in program availability to estimate their effects. We find that programs decrease reincarceration. However, this is mitigated by an increase in future community sentences, usually associated with milder offenses. Programs addressing violence issues, education and employment exhibit strong effects. Those focusing on addiction and other program types are not found to affect recidivism. These results suggest that specific programs can explain the beneficial effects of incarceration found in the literature.