In a statement, Britain's foreign minstry said: "The UK and US governments have reached agreement on the transfer of Mr Binyam Mohamed from Guantanamo Bay to the UK."
"He will be returned as soon as the practical arrangements can be made."
Yvonne Bradley, a US military officer who has acted as Mohamed's lawyer at Guantanamo, said: "Right now we're just happy; I'm just thrilled that he is coming back to the UK.
"His desire is to stay in the UK... He is not the first resident to be returned home and I hope he gets treated in the same way."
Mohamed's transfer will be the first of a Guantanamo prisoner since Obama, who has pledged to close the camp, took office last month.
Mohamed, who was arrested in Pakistan in April 2002, says he was tortured and abused by foreign agents while in custody there.
He says he was later flown to Morocco on a US Central Intelligence Agency (CIA) aircraft, where he was again tortured, before being transferred to Guantanamo in 2004.
Washington has denied that Mohamed, 30, was subjected to "extraordinary rendition", and Morocco has denied ever holding him.
He has been accused of training at al-Qaeda camps in Afghanistan and plotting to set off a radioactive bomb in the US, but no charges have been brought against him.
Mohamed's case has received widespread coverage in Britain.
Earlier this month, the country's high court ruled that documents regarding the alleged torture he was subjected to should remain classified after the US said releasing it could threaten intelligence co-operation between Washington and London.
British officials have said that Mohamed will be a free man when he returns to the UK, but have also said that his immigration status will be reviewed.
"Mr Mohamed's return does not constitute a commitment by the home secretary [interior minister] that he may remain permanently in the UK," the foreign minsitry said.
"The same security considerations will apply to him as would apply to any other foreign national in this country."
British diplomats and a doctor travelled to Guantanamo Bay last week to assess Mohamed's medical condition.
He had been on a hunger strike for more than a month and his lawyers were concerned that he could die.
Mohamed was persuaded to end his hunger strike and assessed to be healthy enough to be flown back to Britain.