What is the reason they buzzed my belly when pregnant? Did the baby hear it?

For stimulation, Yes. Your doctor may want to assess the well being of your baby by performing a fetal non stress test (many reasons). This test should show the baby's heart rate to increase at least 15 beats over the baseline for 15 seconds x2 in 20 minutes. When this does not occur, sound or "buzzing" is done to stimulate (startle) the baby. If the heart rate increases by 15 beats then > 90% the baby should be ok.