Three possibilities:
1. As a magical event, the rain was magic, or magic transported the rain from (and later, presumably, back to) an extraterrestrial place. Likewise, magic would be needed to house 1.6 billion species on a single vessel, and allow each to repopulate without running into genetic difficulties from lack of diversity (i.e. incest).
2. It did not happen at all. It was either made up or a parable.
3. The story was inspired by a real flood that was not global, but magnified and exaggerated over time.
The problem with (1) is that it takes an awful large amount of extra effort; if a god is responsible for the laws of physics, then they would likely be based upon his own example: the path of least resistance. it would have been just as easy for an omnipotent god to inflict a human-specific disease upon all humans; his 'chosen' could be either immune or sequestered away. This suggests that the story is not literal; interpretations were added.
The problem with (2) is that while a global flood of the sort described is, without magic, clearly impossible based on the evidence, there have been enough localized floods that could have inspired the story (as per #3). The flooding of the Black Sea alone could be a likely inspiration; even My. Ararat is not far away.