Yes, as others have said, it affects max turns and the number of years that pass by each turn. In all speeds, the game ends in the year 2050 (I think?).
As you may have expected, build/research times scale with the game length, so that a granary that takes 30 turns to build in Marathon only takes 5 turns to build in Online.
As an aside, this means that, for anyone who is struggling with barbarians, you could try playing a faster speed because you can build more units before the barbarian scout finds you and brings all his buddies.