How Ultrasound Works
Ultrasound works in the same fashion that sonar works for ships at sea. They send out a sound signal and it bounces back. However, when it bounces back, it bounces back with information on what the shape is. Therefore, if there was a deep underwater mountain, the sound would signal that there was a mountain there. If there are twins inside a mother's womb, the ultrasound will do the same thing.
For an ultrasound to even work, there needs to be a transducer. This is the machine used to view the different organs. What it does is emit sound and listen for the returning echoes. It's these echoes that are what give the machine the image. The echoed appears when there is a difference in sound conduction between two tissues. Only some of the sound bounces back, but some stays where it is. This results in that echo.
Once the echo returns back to the machine, it is analyzed and turned into a picture. That's why when a woman is lying there and the nurse is doing the ultrasound, she can see her baby developing in her womb. The different echoes produced the quality image that nurses and doctors can use to see if there are any problems and also to determine the gender of the baby.
The reason ultrasound is used for pre-natal observations and other things is because it can easily get through soft tissue and liquids. For example, a doctor might use an ultrasound to see how the liver is doing because that's a soft organ. The uterus has liquids in them, so the ultrasound is an obvious choice because it can easily get through the liquids.
However, ultrasound can't get through bone or gas. Therefore, other tools are needed to inspect the bones of the body–but that tool has already been created. The X-Ray functions very differently from an ultrasound. In the end, the ultrasound provides an easy way for images to appear on a screen. By bouncing sound off of the object, the different variations in depth and size appear on the screen due to echoes.