Make sure that you are logged into your BitMEX account and go to the Security Centre: https://www.bitmex.com/app/securityCentre
Click the Add TOTP button.
A barcode (QR-code) will be generated for you to scan using your mobile device with your preferred authentication app.
Example (please don't scan this barcode as it will not work):
We support Authy, Google Authenticator (App Store, Google Play Store), and YubiKey hardware devices.
After you have scanned the QR-code into your preferred authentication app, please enter the security token in Two-Factor Token field and click on the Confirm TOTP button.