"It was really strange how they came about," frontman Steve Garrigan told Digital Spy at Glastonbury. "He just turned up to a show, and he likes our music. We had a bit of free time and so we went to the studio and wrote a song. It was good fun.
Asked if they know if the song will be on One Direction's new album, Vinny May said: "There are hundreds of songs flying around."
Garrigan added: "It could be on his album if he does something, but I don't know. Nothing is set in stone."
The singer also revealed plans to have the follow-up to their debut album In a Perfect World out in 2015.
"We're hoping to have it out early next year," he said. "We possibly might have an EP or something like that out by the end of the year."
Kodaline will play the Other Stage at Glastonbury later today (June 28) with Metallica to headline the Pyramid Stage tonight.
Source