The ball was launched into the North Atlantic at St Kilda, the volcanic island archipelago, by John Molyneaux on March 17.
It had been given to the contractor by his colleagues at Ogilvie Fire Protection in Ayr, South Ayrshire as a nod to the 2000 film.
The plot sees the main character marooned on a remote island and befriending a basketball, which he names Wilson.
Mr Molyneaux was helicoptered on to St Kilda for two weeks work and wrote his details on the ball at the end of his time there, before kicking it in to the ocean.
"Wilson" - which had a face painted on it similar to the ball in the movie - floated around the north coast of Scotland and down into the North Sea, before washing up on a beach near the village of Vigso in the north of Denmark.
It was found by a group of German teenage children from the Internat Schloss Rohlstorf boarding school, who were on a hiking trip.
They then mounted a social media appeal to find out who launched the ball and began to contact the names and numbers written on the ball.
The search was covered by German TV and word got back to the original owners.
Paul Ogilvie, who gave the contractor his companion, said: "We couldn't believe it when we saw the photographs and video.
"We knew it was Wilson right away.
"It all started as a bit of fun. When John was going out on the job, we got him the ball and painted the face on it to look like the ball from the film.
"If he was going to be a castaway, we thought it would be a good idea for him to have some company."
Wilson's journey from the island distanced approximately 1,000 nautical miles and took nearly three months, from March 17 until June 13.
It took the children just 51 hours to track down its owners using social media.
Teachers will now use the ball in lessons in the new term, from maths to geography.
Maike Kramhoft from the school said: "The ball is here at our boarding school and was presented to all the parents at our summer party.
"The kids are so proud of it. This is an exciting adventure for all of us - the kids and the adults. It was like a message in a bottle - without the bottle."
St Kilda is the UK's only dual Unesco World Heritage Site and is home to nearly one million seabirds, including the UK's largest colony of Atlantic puffins.
After 4,000 years of human presence, the was evacuated on August 29 1930 after the remaining 36 islanders voted to leave as their way of life was no longer sustainable.
The uninhabited archipelago has been in the care of the National Trust for Scotland (NTS) since 1957.
Islanders used to launch their mail into the sea in the hope that it would be picked up by a passing ship and this tradition continues today through NTS.
Every year the team launches a little wooden boat to see where it turns up, although none have travelled as far as Wilson.
Susan Bain, from NTS, added: "There's a message in this for all of us: the oceans are linked and we all share the same resource.
"We may think we are far away at St Kilda, but this shows how we are all connected."