The 51-year-old woman was arrested in 2015 after people noticed an uncanny resemblance between the girl, Zephany Nurse, and another girl at school.
DNA tests carried out by police then proved that the two girls were sisters.
Judge John Hlophe told the defendant she had “betrayed” Zephany by her actions.
The kidnapped girl’s biological parents, Celeste and Morne Nurse, called her Zephany, but the name she grew up with has not been revealed to protect her identity.
The convicted woman has also not been named for similar reasons.
Local media have previously reported that Zephany does not wish to have a relationship with her biological parents and considers the woman who kidnapped her as her mother.
She has decided to continue living with her abductor’s husband, whom she grew up believing to be her father.
Outside the court, Zephany’s biological grandmother Marilyn said she was not happy with the length of the sentence, but hoped that the family would now have a chance to bond and form a relationship with Zephany.
The judge told the accused she had had “all the time in the world” to return the child but had chosen not to.
Annual local media coverage of the parents’ birthday celebrations for their missing baby daughter meant that there was no way the defendant could not have known they were still looking for her, he said.
He also said her decision to plead not guilty and portray herself as a victim in the affair counted against her.
Bittersweet victory: Pumza Fihlani, BBC News, South Africa
It is a story that has gripped South Africa, but now finally has some form of closure.
The 52-year old woman convicted of kidnapping Zephany Nurse watched stone-faced as the judge handed down his sentence.
Members of the Nurse family and the family of the accused packed the Cape Town courthouse.
Delivering his ruling, Judge Hlope criticised the woman for lying to the court during the trial.
He dismissed as “a fairytale” her claim that the baby girl had been handed to her by another woman at a railway station.
The soft-spoken seamstress raised Zephany as her own, just a few kilometres from the home of her biological parents.
The Nurse family’s victory in court is bittersweet.
The woman responsible for Zephany’s kidnap may be behind bars, but their daughter has decided to continue living with the husband of the woman who kidnapped her.