According to this Apple article, it should work with any iPad:
Apple Wireless Keyboard and Magic Keyboard compatibility with iOS devices - Apple Support.
It use Bluetooth wireless connectivity.
First, make sure the keyboard has fresh batteries. Use a coin to unscrew the silver cap on the left end of the board. It should take two AA batteries. If you flip the board over, there is a tiny image printed on the battery tube showing how many batteries the board requires and how to orient them:
With the board again upright, press and release the silver button on the RIGHT end of the battery tube to turn on the board. A green light near the switch will flash in it powered up.
At this point, pairing with an iPad should be pretty much the same as described in this Apple iPhone document:
Pair Magic Keyboard with iPhone - Apple Support
To turn off the keyboard, press and hold the right button until the green light goes out.
Please post back if you cannot get it to work.