A sonar device emits sound waves into the ocean from the surface. When the impulses strike the bottom they return to the ship carrying the sonar device in the form of an echo. It then computes the depth of the ocean at that point. The longer it takes for the echo to return the deeper the ocean floor is!
Sonar has allowed scientists to accurately map the ocean floor. As a result many interesting discoveries have been made. Including abysses 10,600 m deep (6.3 miles), and mountains higher than Mt Everest the tallest mountain on land at 8,848m (29,198 ft).