There appears to be nothing known for sure (OED being the gold standard of etymology), but an unconfirmed report indicates that it is from a time where the average peasant was illiterate and drew illustrated stories on the walls of houses or buildings. As buildings became larger, they were measured by the number of stories that they could express.
I love that explanation.
(Why do we refer to the floors of buildings as stories?)