The sensor gives the amount of magnetic force in three directions, so (in theory) it should be easy to implement this sensor input.
https://makecode.microbit.org/reference/input/magnetic-force
micro:bit Bluetooth profile specification: https://lancaster-university.github.io/microbit-docs/resources/bluetooth/bluetooth_profile.html
There is a MAGNETOMETER SERVICE.