Aside: A similar question is often asked by folks when I practice my bagpipe chanter. I suspect it is a question of taste on their part and skill on my part without any true consideration of the dog's otic health
Answer:
A dog's ears hear essentially the same as we do with a better registering of higher end frequencies (in excess of 20K Hz) We call these frequencies "ultrasonic"
Pain from sound is caused by air pressure from the pain (loudness). Noise levels of 85 db can cause hearing loss over time. Noise levels of 140 db can cause pain.
A harmonica at its loudest is not in the painful range to the player (the closest set of ears) although it may be detrimental over the years. Sound levels fall off with every doubling of the distance, so at a dog's ear level the sound will be much reduced from that reported by the player's ears.
As a test - consider that dogs can bark loud enough to hurt our ears Dogs ears are closer to the bark than our ears and the sound from their point of veiw is much louder. Barking does not harm a dogs ears.