It all started after Instagram user Omer Yavuz clicked and then shared the picture of the boy.
He was later identified as Muhammet Halit, a 12-year-old shoeshiner, who fled the war in Syria, reports Hurriyet Daily News.
"I wanted people to see Muhammet with sandals on his feet in the cold," Mr Yavuz told BBC. "I couldn't sleep that night, because I couldn't stop thinking about his situation," he added.
The Internet worked its magic and who but the one of the gym owners stumbled upon the picture. Mustafa Kucukkaya posted the picture on Instagram asking if anyone knew the boy. He also added that the gym would be free for him for life.
He later shared another post with a picture of Muhammet stating that they had not only found him but also offered him the free membership as promised.
"Amazing deed, much respect," says one Instagram user on the post. "Thanks guys. We all need stories like this," says another.
"I had always dreamed of losing weight and now I believe I can do that by working out," the 12-year-old told Hurriyet Daily News. Click for more trending news
Get the latest election news, live updates and election schedule for Lok Sabha Elections 2019 on ndtv.com/elections. Like us on Facebook or follow us on Twitter and Instagram for updates from each of the 543 parliamentary seats for the 2019 Indian general elections.