No, not possible.
The Magic Keyboard for iPad Pro only works with the third/fourth generation 12.9” iPad Pro - and first and second generation 11” Ipad Pro. The Apple Magic Keyboard (similar name - but different product) works with both Mac and iPad - but can be paired with only device at a time.
However, there are some third-party Bluetooth keyboards that can be simultaneously paired with multiple devices (such as iPhone, iPhone and Mac) - that allow you to switch between devices with just a single button on the keyboard. One manufacturer is Logitech, but you’ll no doubt find others that have similar feature.
Some examples from Logitech:
Logitech K780
https://www.logitech.com/en-gb/product/k780-multi-device-wireless-keyboard.html?crid=27
Logitech K380
https://www.logitech.com/en-gb/product/multi-device-keyboard-k380?crid=27
Logitech K375
https://www.logitech.com/en-gb/product/k375s-multidevice-keyboard?crid=27
I hope this information proves to be helpful.