You can use an old Magic Keyboard with the 12.9-inch iPad Pro, but…
The first generation of the Magic Keyboard (A1998) is functionally compatible with the new iPad Pro 12.9-inch (5th generation) with Liquid Retina XDR display. Due to the slightly thicker dimensions of this new iPad Pro, it’s possible that the Magic Keyboard may not precisely fit when closed, especially when screen protectors are applied.
The new 11-inch iPad Pro hasn’t adopted the mini-LED tech and its dimensions are the same as the previous model. This means that it is still compatible with previous generation Magic Keyboards, though Apple has also announced a new one that costs $299. Pricing starts at $799 for this tablet.