I saw this earthworm moving horizontally on the wet trunk of a live beech tree last Saturday morning when I was actually looking for slugs. It was about knee high above the ground. A few seconds later, it started crawling down towards the roots.
Everything that grows on beech trunks, the fungi and the algae, are rather flat. I don't think an earthworm's mouth anatomy would let it eat any of that stuff, although I could be mistaken. I suspect this individual was simply exploring, taking advantage of the wet trunk to experience life above the ground for a change.