The problem with demanding the key and jailing him for not doing so is that they haven't (as far as I know) proven he actually remembers the key at all. Have they done anything to prove that he didn't genuinely believe the passwords he told them would decrypt the data? People do forget things all the time, even very important things. Throw in some duress and mental anguish over being jailed plus autism and it's a wonder if he gets his middle name right.
Assuming that the judge followed the requirements of the legislation - and there doesn't seem to be any reason to think that they didn't - that question will have been answered in the following way:
1. By default, the prosecution would have to prove beyond reasonable doubt that the defendant has possession of the key (in this case, by knowing the password).
2. However, where it has been proved that they had the key, there is a presumption that they still have it. I expect that applied here, since they could probably show that he had accessed the encrypted data.
3a. If the defendant does not bring any evidence, then the presumption will stand and they will be found guilty.
3b. If the defendant disputes it, they do not have to prove that they do not have the key. They only need to show enough evidence to "raise an issue" - i.e. for there to be reasonable doubt as to whether they have it. At that point the prosecution must prove beyond reasonable doubt that they do.
I don't know the specific details here - it would have been helpful if the journalists present had transcribed the judge's entire remarks, rather than just presenting one or two quotes out of context. However, I could imagine a situation where a suspect was known to have used the password regularly up until the date of his arrest, at which point he claimed suddenly to have forgotten it, and where that simply wasn't believable - particularly if he had lied to the police or the court about other matters, and had been generally obstructive*. I would also point out that the judge will (unless he chose not to take the stand) have heard whatever Wilson's explanation was from his own mouth, and will have therefore been in a better position than any of us to judge whether he was telling the truth.
*Which you are, of course, free to do, but which is unlikely to improve your credibility.