Good point. She might be in heat. If so--she will be desperate to get out; so you need to be sure she is properly shut inside. If she got pregnant, as thin as she is, it could kill her. She might need to gain weight and get healthier before she can be spayed; a vet will know.
Check these out--
http://www.cat-lovers-only.com/cat-weight-chart.html
The weight charts there can help you figure out just how underweight she is. If she is just a little underweight, she is probably healthy and just needs to gain some weight; if she is in the more extreme categories, she might need medical help to recover from malnutrition.
I once rescued a cat we named Olivia, who was in the thinnest category on all the weight charts when I found her; she did need a vet to help her recover--she saw a vet twice before she was obviously on the mend. She never needed to stay overnight, though she did need treatment for an infection and for fleas and worms. But she is quite healthy now, average weight and apparently ruling the roost in her room at the no-kill where she lives now. Once she had gained some weight, we had her spayed; and the spaying helped her, too, because she had been using up a lot of energy to go into heat over and over.
So--bottom line, skinny cats can recover, but they really should see a vet.