Additional to the excellent suggestions from LotusPilot, I will suggest a few other points
Your report seems to be the only one of its kind (so far) so my feeling is this will be something unique to your setup, either a specific software glitch or a hardware defect (but which one... keyboard or iPad?)
Hit the App Store, and make sure all your third party apps are fully updated to the latest version. For apps you use regularly which might be suspects in the keyboard problem, go into each app's page and look with your eyes for any updates offered. I have seen it happen that updates exist but they have not been offered until I searched the hard way!
Try to think back to what you were doing in the last usage before the problem appeared (last hour or so). Is there a pattern, which might suggest one app is causing problems for everything else which follows?
Does the problem first appear each time in one specific app? (might be difficult to be sure if you have one app which you use more than others)
If you disconnect the Magic Keyboard after the problem appears and use your iPad stand alone, does it resume working correctly with on screen keyboard, or does the fault remain active until restart? (This might be a clue whether it is a software lock-up, -or- a hardware problem which is unlikely to roll through to standalone usage)
The bottom line is as LotusPilot suggests. If you can't resolve it in a day or two, get it raised as a case in the Apple Support system, and if it has not been cleared by Day 10 of your 14 day return window, reject the devices for replacement with new. My only reject experience (with a Series 3 Apple Watch) is that if there is a defect within 14 days they will probably offer to replace with a brand new replacement rather than have you return, refund, buy again. After 14 days you might get a service exchange unit, which could be reconditioned or new (no way to predict but I doubt there will be many reconditioned around for a few weeks yet).