The Root of the Behavior
Being as crafty as humans can be, we have crafted devices that can replicate these higher pitched sounds to be used for training tools. The most well known of these tools may be the dog whistle. A dog whistle produces a high-frequency sound that can barely be heard to the human ear but cuts through the sky and is heard far away by a dog. This is what makes them an exceptional training tool as it can get your dogs attention from extremely long distances. Other common tools include a high pitched bark collar which produces a loud high-frequency sound whenever your dog is barking in an attempt to dissuade them from continuing. These are safer then shock collars and the sound created would likely be inaudible to the human ear. The pitch of these sounds prevent any damage to the canines hearing and should not contribute to any deafness.
Encouraging the Behavior
Many dog owners use their kennel for this type of thing and many dogs like that method. Leaving a blanket they enjoy or a toy or two to entertain them will make this spot a great place for them to relax in and reduce their anxiety. This is called denning, and places like these feel comforting and safe to a canine. For sounds they do not hear every day that gives them stress, such as fireworks, there are audio tracks you can buy to desensitize your dog to these noises. They essentially play the sounds a firework would make on repeat, which will eventually make your dog less fearful of them. When using audio tracks like these, be sure to keep the volume to a degree that will not hurt your dog's ears and overload their hearing. Exceptionally loud noises can cause hearing impairment.