What-ever. It's got about the same validity as the "gay panic" defense.
He raped her, plain and simple. It's a classic defense to obfuscate the facts by introducing doubt through disorder. Don't know how the Canadian legal system works, but if this case were in the U.S., all the defense would have to do is introduce reasonable doubt. It's how countless rapes remain unprosecuted, and why women aren't always willing to press charges. For that matter, it's why rape trials are a bloody hell for women in the first place. That's sexism - it allows the defense of rape by blaming the woman: did she lead him on? was there a discussion about sex? had they had sex before? was he conscious of his behaviour? why didn't she leave the room? didn't she notice sooner?
Seriously, let's turn the tables here - a man wakes up in the middle of the night to discover that his wife/girlfriend has sliced off his penis with a knife from the kitchen. Since she has an acknowledged sleeping disorder and has admitted to sleepwalking before, she has no memory of the incident. You can bet she's going to jail, regardless of her defense. If this were the story, I really don't think there'd be any discussion here over whether or not he could have avoided the situation by not sleeping in the same bed with her, or joking about what a pleasurable experience it must have been for her to slice off his penis.
Let's go a little further - suppose instead of a woman he met at a party, it was a male drinking buddy he passed out with on the couch. Again, if his friend woke up being raped by him, I don't think the discussion about this incident would be the same at all.
mkrishnan has closest to right here - it's his fracking problem, not hers. He didn't take responsibility for something he knew he should. He didn't tell her it could happen, he didn't leave the room when he felt himself starting to fall asleep. Folks with serious mental disorders who have consciously not taken or sought treatment have been prosecuted - there is no difference here. Hell, in this day and age, people are being prosecuted for spreading HIV. He made a conscious decision to accompany her to the bedroom, and did not tell her about his "condition." A reasonable person would not expect to wake up being raped, regardless of the cause.
Seriously folks, grow up.