A deterrence discourages you from doing something. An invisible electric fence is an excellent deterrence for dogs who like to roam outside the yard.
You can influence someone's actions by promoting certain behaviors and discouraging others. And it's the discouragement part where deterrence comes in. A deterrence makes you reconsider doing something — usually bad things like stealing or skipping school — because you know the penalty will be harsh. Deterrences make you afraid to try something. So many homeowners hope that a security alarm will be a deterrence to burglars.