Hi
@sirpandip, welcome to Dementia Talking Point. This is a very friendly community and you'll get lots of help and advice here.
I don't know that it is a legal requirement that you have to do what the doctor says as such, but it is advice that I think would be unwise to dismiss lightly. Without more details it's difficult to comment more but maybe my own family's recent experience as outlined below may help.
My mother in law lived at home for many years with help from my brother in law, who didn't live with her but visited at least twice a day. When her needs increased he was loathe to get any help in. By then my husband felt a care home would be more appropriate as MiL was on her own for long periods of time and could do little for herself. BiL and one sister in law were very against that happening, as they felt their mother was so attached to her home, so reluctantly carers were introduced. This worked well for a time. However after a few months the company said they thought MiL's needed more care than they could provide. The doctor and social worker agreed, and she moved into a home where she seems to be very settled and certainly much better looked after than she used to be. I don't even think she has noticed she is living somewhere else. The family could have ignored the advice and found another company but I think it would have been to the detriment of my MiL's well-being.
I know the thought of a care home can be distressing and it isn't what any of us want for our loved ones, but it is sometimes what they need.