He had been convicted in absentia and sentenced to 10 years in prison for charges including the burning of a police station, which he said occurred while he was playing in a televised match.

The royal family of Bahrain, which is Sunni Muslim, has pursued an aggressive crackdown against calls for democracy from the kingdom’s Shiite Muslim majority, including a campaign of widespread arrests and many convictions on what human rights groups say are trumped-up charges.

Thailand, which has been run by a military junta since a 2014 coup, has sent people fleeing political oppression back to countries including China, raising fears that Mr. al-Araibi would also be returned.

But the country has also shown signs that it can be moved by international pressure.

Last month, a Saudi woman who said she was fleeing abuse from her family barricaded herself in a Bangkok airport hotel room and rallied support to her cause online. The woman, Rahaf Mohammed Alqunun, 18, was allowed to leave the airport after a two-day standoff and was granted asylum in Canada.

Mr. al-Araibi received widespread support from the international sports world, including FIFA, the international body that oversees global soccer; the International Olympic Committee; and the World Players Association, an umbrella group representing 85,000 professional athletes worldwide.

Jamie Vardy, a striker for the English Premier League club Leicester City, expressed support for Mr. al-Araibi on Twitter, and Craig Foster, a broadcaster and former captain of the Australian national men’s team, was a prominent advocate for his release.

“This is a big victory for that global campaign and marks the fact that football will have to play an important role in human rights going forward,” said Phil Robertson, deputy Asia director for Human Rights Watch. “They call football the beautiful game, and it is a beautiful day for the beautiful game.”