I had the same problem today. Here's what I did to fix it.
Scenario: Surface 4 Pro, plus OEM type cover. My GF's laptop, actually. I recently updated it to Windows 10 build 1909 (in the last couple of months). She doesn't use it every day, only a few times a week. Turned it on today, told me the keyboard didn't
work.
Checked mechanical, no issues found. Checked function in UEFI, non-functional. Typically this indicates a faulty keyboard. But the Surface keyboard uses writeable firmware, so a possibility existed that there was a firmware issue.
Anyway, the fix in my case was to download the most recent Surface drivers. Windows Updates showed no new updates / patches (I was already up to date). Here's the general page:
https://support.microsoft.com/en-us/help/4023482/surface-download-drivers-and-firmware
and I went to the page for my laptop, the Surface 4 Pro:
https://www.microsoft.com/download/details.aspx?id=49498
The Download button will download a bunch of files, some MSI and some zipped folders. I didn't bother to check if the MSIs are dependent on the zipped folder content, but I unzipped them all anyway.
I first installed the file
"SurfacePro4_Win10_1701001_0.msi" and rebooted. No change.
I chose that file because there is a matching folder (from the zip files) that contains firmware images. And it is the highest number sequence (e.g. latest version).
Then I installed the file
"SurfacePro4_Win10_18362_20.034.43185.0.msi" and rebooted. Success! The type cover worked again.
Now, I'm pretty sure that the first package did not contribute to the fix, but I have no way of confirming that. But anyway, in my case, the above resolved the issue.