When unit has Diving Goggles in inventory's goggles slot, these are automatically shown in unit's model when entering the water (surfaceIsWater == true), and they are automatically hidden back a few meters out of the water.
Likewise but in opposition, non-underwater goggles (glasses/shades/spectacles) are automatically shown when a few meters away from the water, but automatically hidden as soon as (surfaceIsWater == true).
I suggest if this automatism is to prevail, it should be accompanied with the item assignItem/unassignItem* in the inventory from it's goggles slot.
*both unassignItem and unlinkItem commands are broken when used with any goggles (see ticket - http://feedback.arma3.com/view.php?id=13189), disallowing the scripter to workaround the current functionality.