Sonar is the technology of making use of sound waves to navigate, communicate and detect objects on or under surface of water.
how it works:
It emits an acoustic signal or pulse into the water and if an object is in the way of the acoustic pulse then the sound bounces back and returns an echo to the sonar transducer. The sonar transducer in turn measures the strength of the signal. By determining the time between the emission of the acoustic signal and its reception, the transducer is able to determine the orientation and range of the object.
so when these sound waves hit the floor of the sea and reflected back to the device , depth can be measured.