A judge working for the militant group al-Shabab said she had had an affair with an unmarried 29-year-old man.
He said she gave birth to a still-born baby and was found guilty of adultery.
Her boyfriend was given 100 lashes.

It is thought to be the second time a woman has been stoned to death for adultery by al-Shabab.
She was then stoned to death in front of the crowds on Tuesday afternoon.
The judge, Sheikh Ibrahim Abdirahman, said her unmarried boyfriend was given 100 lashes at the same venue.

An unmarried person who has sex before marriage is liable to be given 100 lashes.
His pregnant girlfriend was spared, until she gives birth.
A girl was stoned to death for adultery in the southern town of Kismayo last year.

Last month, two men were stoned to death in Merka after being accused of spying.
The country has not had a functioning national government for 18 years.
Story byZee
Former CEO of The Next Web.