When you warn someone, you advise them to be careful or tell them about a problem or danger. If you perform a dangerous stunt, you should probably warn your audience, "Don't try this at home."
Many traffic signs are meant to warn drivers about hazards, like bridges that get slippery in the rain or bumps in the road. And the purpose of a dog's growl is to warn another dog (or human) that it's stressed or fearful. A warning is a helpful message, no matter what form it comes in, and to warn is to send this message. The Old English root is warnian, "give notice of impending danger."