Reset the System Management Controller (SMC)
If your Mac has a removable battery, remove it, as well as the power source. Next, press and hold the Power button for five seconds, then reinstall the battery and power up the Mac.
For a Mac with a non-removable battery, hold down Ctrl + Option + Shift on the keyboard, then press and hold down the Power button for ten seconds. When you’re ready, release them and power the MacBook up again. This should reset the SMC and get your trackpad working again.