As is often the case in science the answer is complex. Some butterflies appear to have fairly sophisticated "ears," some appear to not possess the ability to hear. But what is most interesting is how scientists discover these fascinating facts. For example when the question is extended to caterpillars the story of how scientists discovered that they hear is fascinating. A budding scientist decided to do a test to see if caterpillars reacted to sound. He had a little sound generator and tested different frequencies to see if they noticed any reaction from the caterpillars.
The caterpillars ignored most sounds but there was a narrow band of frequencies that caused them to "dance." The interesting thing is that these frequencies were very low. He thought about this and tested different things in nature that make that low frequency, and he found that that frequency is created when birds flap their wings! Makes sense, doesn't it? A caterpillar can hear when a bird is flying overhead and take cover.
This is where the science gets so interesting. Clearly they could hear, but how did they? A college student noticed that the little hairs on the caterpillar's back were equidistant from each other. The spacing was the same length as the sound frequency to which they responded. They hypothesized that the hairs on the caterpillar's back acted like the little hairs in our ear, making the caterpillar act like a walking ear drum. To test this out, they shaved the hairs off a caterpillar and noticed that it didn't react anymore to the low frequency sound.
I learned once again that we do not know enough to be so bold as to think our knowledge will be sufficient to save us from environmental destruction. We are filled with hubris. There is a wonderful verse in Isaiah (55:8-9) For My thoughts are not your thoughts, Nor are your ways My ways,” says the Lord. “For as the heavens are higher than the earth, So are My ways higher than your ways, And My thoughts than your thoughts