Hey there SylviaMN,
Thanks for reaching out to the Apple Support Communities. If having issues with your Magic Keyboard not working with your iPad, we'd recommend following the steps listed below from the following resource: If you can't connect your iPad to your Magic Keyboard, Smart Keyboard, or Smart Keyboard Folio - Apple Support
1. Update your iPad to the latest version of iPadOS. Go to Settings and tap the Software Update Available notification. If you don't see a notification, go to General > Software Update to see if an update is available.
2. Remove any other iPad case or cover if you're using Magic Keyboard or Smart Keyboard Folio.
3. Connect your Magic Keyboard or Smart Keyboard / Smart Keyboard Folio.
4. If your keyboard doesn't immediately respond, restart your iPad.
5. If your keyboard is not connecting, or if you're experiencing issues unrelated to connecting, contact Apple Support.
If you've already gone through all the steps above, then we'd recommend reaching out to Apple Support directly using the link provided in step 5 above.
We hope that's able to help.
Take care!