Jihad Diyab, a Syrian, was one of a group of six Guantanamo detainees who were given asylum in Uruguay in 2014 as part of efforts to close the camp.
He had been on hunger strike for 68 days and was at risk of dying.
Mr Diyab had been demanding to be transferred to an Arab country.
He said that he wanted to be reunited with his family.
His supporters have not revealed which country has agreed to take him but officials have made clear that he cannot return to Syria because of the civil war there.