I have this issue as well.
Brand new iPad Pro 12.9. Brand new Smart (not so Smart) Keyboard.
It may be a software issue, but it could coincidentally be a hardware issue too.
I have found that ‘rocking’ the iPad itself, whilst it’s sitting in the keyboard, will sometimes make the keyboard come and go (the software keyboard appears/disappears). If the Smart Keyboard is not recognised and gentle rocking doesn’t work, I’ve found that lifting it away, at one corner, from the magnet ‘grip’ will make it return when the magnets slam back together. Sometimes it seems that the keyboard needs to be on a flat surface, other times not. This all suggests to me that there is something going on with the connectors. As I say, maybe it’s a combination of software and hardware issues.
So far ... with an absolute ‘top-of-the-line‘ specked out iPad Pro 12.9, Apple have failed spectacularly on the ‘out of box’ experience: 2 hours with Apple support trying to get my Messages to sync from an iPhone backup and to date about 6 or 7 hours spent trying to fix it myself (and failing) I’m getting ready to go up the next level of support and to spend more *unpaid* time trying to fix what should ‘just work’. Does anyone believe in resurrection? Any idea how we can get Steve Jobs back on board? And now of course, this issue with the keyboard (which I really like apart from this connection problem ... and the noise that the space bar makes).
Ho hum.