Due to their short ranges, ultrasonic (>20khz) frequencies aren't used for ship or submarines' primary Active Sonar systems. Though the actual frequencies used are classified, I can say that they're nowhere near the ultrasonic range.
Submarines do employ ultrasonic frequency detection systems that are passive sonar based, but they're primarily for detecting active sonar from homing torpedoes. They're also annoying for detecting any bottle-nosed dolphins in the area when you're at Periscope Depth.
Type your answer here... ASDIC
They were used by submarines to navigate when not in open waters, They were also used by submarines and anti-submarine ships to locate enemy submarines.
sonar hydrophones
They use sonar to find the enemy. Passively, they listen for the sounds of the other ships, which will give them a bearing to the target. Active sonar will ping the enemy and provide a range as well.
Sonar was used widely in World War II in an effort to locate enemy submarines. It wasn't as sophisticated as it is today, but it did help. Actual numbers are difficult to come by, but sonar was effective in the successful attacks on several submarines.
Detection of (enemy) submarines.
By an electronic device called 'sonar' .
Active sonar ping is audible, so is not ultrasonic. Passive sonar just listens, but it takes time to determine objects bearing, speed & direction of travel. There is ultrasonic sonar for short range detection such as mines and frogman.
Sonar
sonar was discorvered in 1840 the early sientist Sarah Nolsoc. but first used by Samantha Layor
Sonar
The main method is through listening using passive Sonar. Active sonar sends out a sound signal that can be used to bounce off the enemy. It may also give away their own position.