Sonar is a system that uses audible "pings" to bounce sounds off of objects and detect their presence, distance or indeed their density. It is, like many technical terms, an acronym - SOund Navigation And Ranging.
It is simple to use for robotics as a quick gauge of distance to an object and can be used for basic object avoidance. This method was used by the Cybot and a sonar module is now present in the Lego NXT. The way it is used by robots is very rarely as sophisticated as creating a sweep of an area as you might see in a submarine movie.
Sonar units may be salvaged from some of the Polaroid cameras, and also picked up from Maplin as car parking sensor kits.
Time to build your own robot! Using a Raspberry Pi with parts and some time, you can use my book to learn how to make and program a robot with automatic behaviours.