This is called the inertia switch and I am attaching the info below and is used to cut the fuel off in the event of an accident or rollover.
However, I suspect you have an issue with fuel pressure or the engine not starting. If you do then here is a guide that will help with checking it to be sure:
Repair Safety Notice: This information is for general instructional purposes only. Vehicle repair can be dangerous. Verify all information, follow manufacturer service procedures, use proper tools and safety equipment, and consult a qualified repair shop when needed.