If it looks like the photo, that is an inertia switch for the fuel pump. It is triggered in an accident to cut off the power to the fuel pump to prevent fire if the fuel lines are ruptured. Only a fairly sharp impact will trip it. These are available at www.rockauto.com and other places.
Search Volkswagen Beetle Questions
Volkswagen Beetle Experts