Another way to say "prision is a deterrent for crime" is "The prospect of going to prison is a deterrent."