Michelle Owens, 28, was sentenced at Belfast Crown Court after pleading guilty to the manslaughter of Brendan Owens, 3, in their home at Trinity Terrace, Lisburn, in July 2013.
The child died after being suffocated with a pillow.
The judge said he was satisfied that Owens was very unwell at the time.
He described it as a tragic situation for both her and her son and made the hospital order without time restrictions.
A consultant psychiatrist told the court that the defendant was suffering from paranoid schizophrenia and did not want the child to be taken into care because she believed he could be abused in a home.
The court heard that Owens told her son that "mummy's going to help you in case the bad men get you", before placing the pillow over his face.
The judge said he believed Owens had been a loving mother and that she bitterly regrets the death of her son.

Media playback is not supported on this device
In a repeat of the 2015 quarter-final, McGill gained revenge despite falling 5-4 behind after the first session.
A high-quality encounter saw world number 30 McGill and 2005 champion Murphy make two centuries each.
Five-time champion Ronnie O'Sullivan opened up a 6-3 lead over qualifier David Gilbert in the first round.
O'Sullivan made breaks of 82, 74 and 71, but world number 22 Gilbert showed his ability with a superb 125 clearance. They play to a finish on Monday from 10:00 BST.
Alan McManus progressed with a 10-7 victory over fellow Scot Stephen Maguire, who lost in the first round for the fourth consecutive year. McManus will face Ali Carter in the second round on Thursday.
In Sunday's evening session, Welshman Mark Williams took a 7-2 lead over fellow former champion Graeme Dott of Scotland, while England's Sam Baird led Michael White of Wales 5-4. Both matches resume on Monday (19:00 BST).
Murphy, 33, becomes the third world champion after Peter Ebdon and Stuart Bingham to exit the competition.
This is only the second time that the previous year's finalists have both fallen at the first hurdle.
The last occasion was in 1980 when Terry Griffiths and Dennis Taylor both lost in the second round after receiving first-round byes.
McGill, 25, comes up against Ebdon's conqueror Marco Fu in the next round.
"I'm obviously disappointed but having a child on the way has change my perspective on things," said Murphy. "It is just a game of snooker.
"My preparation could not have been better. My game was in better shape than last year.
"If Anthony can keep his composure, keep himself under wraps and play with enjoyment, he will take some stopping."
McGill made his debut at the event last year, beating Stephen Maguire and ousting then defending champion Mark Selby, before falling to Murphy in the last eight.
Despite making only his second appearance at the Crucible, the Scot showed no sign of nerves and looked comfortable around the table.
His ruthlessness among the balls - managing breaks of 119, 117, 97 and 85 - underlined his quality.
"When I came here last year, I had no ambitions of winning and I just wanted to enjoy it," said McGill.
"It is an honour for me to play here and a lot of people around the world want to do it. It is a privilege."
A mother who admitted killing her toddler son at their Lisburn home almost two years ago has been placed under a psychiatric hospital order.
[NEXT_CONCEPT]
Last year's finalist Shaun Murphy suffered a shock 10-8 first-round loss to qualifier Anthony McGill at the World Championship in Sheffield.