Before an ultrasound your doctor should tell you whether or not you should drink any water before the ultrasound.
But for most ultrasounds you'll need to fast and not eat anything before the ultrasound but drinking water during that fasting is usually fine.
Some ultrasounds require you to have your bladder near full or full when the ultrasound happens for the best test results.
If you're having a Pelvic Ultrasound done then it requires at least 40 ounces of water to be drank one hour prior to the ultrasound appointment.
If it's an abdominal ultrasound then no water is required to be consumed prior to the ultrasound but drinking some water before the ultrasound is okay.