The response of /u/Snowchill is not entirely accurate. It's true that horses weren't widespread in the Athenian army during this period, but elites were still likely to have horses and some would be brought to war, including for delivering messages. Aristotle's Constitution of the Athenians 7 tells us that one of the four property classes Solon instituted was the "horseman." Despite the reforms of Cleisthenes in c. 510, we know that Solonian property classes were still in effect for military mobilization at the time of Marathon in 490 (as M. Johanson points out in his 2001 article "The Inscription from Troizen: a Decree of Themistocles?" ZPE 137).
So, most likely there were horses at the battle of Marathon, and they could have easily been used to deliver messages. Why then did someone run to deliver a message? Well, short answer: They probably didn't. We don't hear about the running messenger story in Herodotus or any other near contemporary historian; Herodotus only mentions that a running messenger was sent from Athens to Sparta (6.105-106), but this is not the famous Marathon run and is instead tied to a story about how the runner met the god Pan on his journey. The first author who mentions the Marathon run is Plutarch, writing in the 1st-2nd century A.D. (about 600 years after the battle!), and we find the story fully formed in the works of Lucian, writing in the 2nd century A.D.
So, TLDR, the most likely solution is that the Marathon run was a later invention and the Athenians most likely used a horse to deliver their message.
Horses weren't really widespread that much at the time of the battle of Marathon. Greeks at the time were mostly Hoplites. The use of horses in battle came to be in the 4th century BC, with Xenophon himself writing a book about how to be a cavalry commander and taking care of horses. All in all though, the best cavalry users in ancient Greece were the Thessalians and the Macedonians, who had much more flatlans to breed and use horses. Athenians, on the other hand, didn't. Hence why the use of a horse wasn't widespread.