Both procedures rely on high-frequency reflection of sound waves. Both procedures determine the time that it takes for the high-frequency sound waves to hit objects. However, sonar and ultrasound are not the same procedure.
Ultrasound is a technique that emits high-frequency sound waves (which cannot be heard by humans) into body tissue in order to create pictures of those tissues or organs. For example, ultrasound is used to create images of a developing child within a pregnant mother.
Sonar (which stands for Sound Navigation And Ranging) uses the reflection of high-frequency sound waves to measure the water's depth. In the same way, sonar is used to create maps of the ocean floor. Animals, such as bats and dolphins, use a form of sonar called echolocation as means of navigation and determining where predators are prey are located.