There are actually several reasons. Originally it was to prevent shaving off precious metal from the coin back when they were made of silver and gold but the tradition carried on because of additional uses. It also helps to make the coins harder to counterfeit and makes them easier to distinguish for people with visual disabilities as the penny and dime are similar size and weight.