After meeting with two British Muslim peers, the president ordered that Gillian Gibbons, 54, be freed.
Gillian Gibbons, 54, was arrested a little over a week ago on blasphemy charges in Khartoum, the capital of Sudan, after her class of primary school pupils named a teddy bear Muhammad in September.
Islamic Sharia law is in force in some parts of Sudan, including the capital.
Although Gibbons said that the act was not intended in any way as an insult to the Prophet Muhammad, she was charged with insulting religion, inciting hatred and showing contempt for religious beliefs. She could have faced up to 40 lashes, six months in prison or a fine.
She was sentenced to 15 days in prison on November 30, and crowds of hard-line Muslims marched the streets of the capital calling for her execution after last Friday's prayers.
Gibbons said in a statement after being released that she was "sorry if I caused any distress." She was reported to be preparing to fly home.
U.K. Prime Minister Gordon Brown said he was "delighted and relieved."
Speaking to journalists in Liverpool, Gibbons' son John said he was "very pleased".
He said: "I'd like to thank the government for all they have done, the hard work behind the scenes, especially the two peers who went out there."
Inayat Bunglawala, spokesman for the Muslim Council of Britain, said Gibbons "should never have been arrested in the first place, let alone convicted of any crime".
"There was no crime, it was a wholly innocent and naive ... The worst you could say about her actions is that she was inadvertently naive. She should not be put in prison for that," he said.
However, hard-line Muslim clerics have rejected Britain's claims that the incident was the result of an "innocent misunderstanding."
"What has happened was not haphazard or carried out of ignorance, but rather a calculated action and another ring in the circles of plotting against Islam," the Sudanese Assembly of the Ulemas said in a statement.
"It is part of the campaign of the so called war against terrorism and the intense media campaign against Islam," the statement concluded.