Get a wired mouse and keyboard and use them to turn Bluetooth back on. (Wireless ones that use proprietary USB plug receivers will also do - they appear to a computer to be USB devices.)
If the wireless keyboard in question is a Magic Keyboard that you recharge by plugging it into a Mac, you can plug it into the Mac and use it temporarily as a wired keyboard until your Bluetooth settings are fixed. I don't think that the Magic Mouse can be used as a wired mouse. The charging port is on the underside of the mouse; when you plug in a cable, the mouse becomes unusable.