Is it safe to seal the seams/gaps on washer and dryer units?
Yes, it is safe to seal the housing seams with silicone caulk. You aren't going to cause fire or electrical problems doing so (within reason). Use a fine tip and press it in firmly so as to not make a goopy mess of your appliance.
However, I don't think this will accomplish your goal. If the unit is shaking around so much that it's squeaking and buzzing it needs other repair. If not, the sound will make its way out underneath or elsewhere anyway. Adding foam insulation inside could cause heat problems. There's a rather large motor in there, along with heating elements, and the system is designed to manage heat as it is through air convection and metal conduction.