In Vietnam it the rivers were mined to prevent the safe passage of forces opposed to Ho Chi Minh. There were forces with the primary duty to clear these mines.
Mine clearance forces also were essential to the security of Vietnam's
waterways. Nowhere was this more crucial than on the rivers near
Saigon, the country's most vital port. Viet Cong mining of the main
shipping channel, the Long Tau River, which wound its way through the
Rung Sat Special Zone south of the capital, could have had a
devastating effect on the war effort.
In addition the US used mines to prevent the VC from using the waterways.
This site has a listing of different munitions and this PDF has better specs on weapons deployed in Iraq. A contact mine does not care what contacts it but generally requires the contact have enough force to prevent accidental detonation from wave action or debris.
This US Navy Marine Mammal site claims:
Sea mines are made so that they cannot be set off easily by wave
action or marine animals growing on or bumping into them.
However the UK Naval Mine Countermeasures site indicates that WWI Era Mines were more volatile. It also indicates that devices similar to the WWI designs have been used as recently as 1980 during the Iran-Iraq war, and that its forces are still called to deal with legacy WWI and WWII devices.
So the devices being deployed today are designed not to detonate due to contact with sea life. Their are older devices still found (though rarely now) that are not discriminant.