The woman, who had been suffering from psychological problems and was living at a home for people with special needs, had been reported missing Friday afternoon, said Ulf Karlsson, a spokesman for police in the southeastern town of Kalmar.
There was no sign of her until Sunday morning, when "one and a half days later they opened the doors to the Kalmar castle's inner courtyard, and a janitor found the woman there," he told AFP.
The woman, who had spent two nights out in below freezing temperatures, "was showing slight signs of life when she was found, but her body temperature was much too low, and she died," Karlsson added.
Following the discovery, police had spoken with staff who said they had seen the woman attend a special New Year's Eve mass at the castle, which was first built in the 12th century but owes its Renaissance style to a 16th century makeover.
"They had seen her alive at 4.45pm and had asked her to leave before locking up, but somehow this woman stayed behind," Karlsson said.
He said there had been a way for her to get out, passing through the restrooms to an unlocked door on the other side, "but I guess she didn't find it."