To build on this and a number of the other comments in here:
There are two general types of sonar. Active, and Passive. Passive sonar involves the process of listening for signals, categorizing their type and origin, and determining their range and bearing. This is a difficult task, though the world's most sophisticated navies can perform this well. It is the preferred method of detecting other submarines (or for submarines to detect other vessels) because it does not give away the location of itself.
Passive of course, has limitations. Variations in water conditions and temperatures, silencing techniques used in adversary craft, a limitations of one's own equipment can make passive difficult, if not impossible in some conditions. And even then, it is a best guess at detection. Passive sonar will give you a pretty close approximation under good conditions and a "well, he's out there" in the worse. (In the most high-tech vessels, it's a bit better than this, but I think I have the gist)
Active on the other hand, is precise. Very precise. It also means, the gig is up, because the emitting craft is heard by everyone, extremely clearly. An active ping that gives a good return can give you precise range and bearing, and in some cases, velocity. It's of limited range, so typically submarines will hunt with passive and use active in the closing stages of an engagement.
Typically when I read about active sonar harming wildlife, it's in reference to the large active arrays carried by destroyers and submarines. Active is used by sonobouys, navigation equipment, and torpedoes as well, but these are typically lower power output.
The active array on a warship however, is generally massive, especially on a modern attack sub. They're powerful, and will produce pings against objects at thousands of yards. (I've even read that some British subs, such as the Trafalgar class, can bounce a signal off the bottom of the seabed, and get a return on a distance object from the reflected bounce.)
These massive arrays are important, because if you suspect an adversary has been tracking you passively, but you can't find them, then active scan can save you by alerting you to where they are. Tactically, it is a last ditch option, or the closing move in an engagement, and it's not unusual to see a safety cover over the switch to an active array. But it does have a purpose, and the Navy, justifiably so, does need to train with it.
But it does come with a cost, and it won't take long for one to search google for images of whale and dolphins with their ears literally blown to shreds because of an active scan.
I sympathize with both sides on this one, and I'm glad a settlement was reached that hopefully produces a good compromise.