The 20-year-old mother will not spend time in jail, but will live under house arrest for three years.
The woman, who cannot be named to protect the identity of the child, put the baby up for sale for 5,000 rand in an advertisement on the Gumtree website last year.
A member of the public alerted the police who arrested her in an undercover operation in October.
"She was given a wholly-suspended sentence of five years," National Prosecuting Authority spokeswoman Natasha Ramkisson-Kara told AFP.
Also Read
The mother said she had tried selling her baby after her boyfriend stopped paying childcare following paternity tests that showed he was not the child's father.
Human trafficking carries a maximum life jail term or a fine of 100 million rand (USD 6.7 million).
But the court sitting in the eastern city of Pietermaritzburg yesterday handed down a lighter sentence after considering the woman's circumstances.
"The magistrate found that the woman did not have intention per se to traffick the child," said Ramkisson-Kara.