I had the same thing happen to me a year or so ago. I went to pee, started, and then all of a sudden I found myself on the floor. I had no idea why I was on the floor or how long I had been there. I went to the doctor to see what the deal was and nothing was apparent. No idea why exactly that happened to me, but I'll say for the next few times I went to pee I made sure to hold on to the towel rack bar.
Had you eaten or drunk much the day you fainted? Perhaps your blood sugar was low or you were dehydrated enough to faint. I can't remember if I had eaten or drunk much the day I fainted, but I'm pretty sure that was the reason why.