For our first child, I was considering building a DIY ultrasound machine, since I had several friends doing their final MSc project on ultrasound hardware and software. I came as far as setting up a shopping list, where I assumed a high-end laptop and Matlab with all toolboxes for free, together with some code from my friends. Still I ended up north of $3k for hardware, and several hundred projected work-hours. A lot of the cost comes from needing 50-100 transducers to get a useable image.
OTOH, the single transducer doppler ultrasound devices that's used in early pregnancy to hear the baby heartbeat can be had for $30 on ebay.