A marathon was a long-distance foot race, typically around forty-two kilometers in length, named after the Battle of Marathon.
By the 24th century, Starfleet Academy had an official marathon run by its cadets. Jean-Luc Picard became the first freshman to win the race when it was run on Danula II in 2323, passing four upperclassmen on the final hill. (TNG: "The Best of Both Worlds, Part II", "Chain Of Command, Part I")
In 2366, Devinoni Ral told William T. Riker that "the last mile of the marathon is always the toughest", referring to ongoing negotiations over the use of the Barzan wormhole. (TNG: "The Price")
The term could also be used to describe a prolonged period of engaging in a particular activity. In 2375, Neelix mentioned allowing Tom Paris to replicate pork rinds for his monster movie marathon. (VOY: "Warhead")