Hi, I'm sorry to hear about this, but chin up, it's very stressful to have a sick relative and all the bureaucracy that involves, but there's no need to catastrophise about homelessness and not eating or sleeping isn't going to help anyone, action is what's needed here. You must have known there was at least a possibility this would come to pass one day, there's quite a lot of good information out there on the internet so get on your research now (AgeUk is a good starting point).
I assume the council/local authority is paying the care home fees at the moment and they have assessed her as needing to be in the home permanently? It's a separate question really whether it would be safe for her to come home and be cared for by you, I'd think very carefully about offering this if I was you, if her needs have been high enough to need a home it's going to be a really big job for one person to take on, especially as you have a young child to care for too. To be honest whilst it's kind of you to want to care for your grandmother, if social services think the home is the best place for her I wouldn't try and move her now. If she stays in the home you can dedicate your energies to visiting and supporting her, also to putting yourself in a better position financially in the longer term (it will be easier to seek or improve your employment situation for instance if you're not 24/7 caring).
As to whether the house would need to be sold, it depends I'm afraid. You don't fall into one of the criteria for a 'mandatory disregard' in which the value of a person's house isn't counted when assessing their financial contributions towards their care, unless you or your child are disabled which you don't mention. However you could ask the local authority for a discretionary disregard, if you can show that you moved in to the house purely to care for your grandmother. That would be worth doing although there's no guarantee. There may be other solutions the council would consider too e.g. you paying market rent to live in the house and that being put towards the fees, and/or a charge being placed on the property so it is only sold after her death, which would hopefully give you some space to sort yourself out.
Also, since your grandmother only owns part of the house, it's only that part that will be taken into account for the assessment (unless she deliberately gave half to your mother to avoid paying care home fees which is called deprivation of assets). So it would be worth talking to your mother about whether there's any solution to be found there if talking to the council doesn't work, e.g. can she raise a mortgage on her half to effectively buy your grandmother out, and you contribute to the costs of that? Or if the property does have to be sold, could she loan you the money from her share to get set up in a private rental?
Best of luck, I'm sure you'll sort something.