Yes a nursing home can refuse to take a patient back especially if the nursing home patient is being a threat to the nursing home staff or to any other patient in the nursing home.
Some nursing homes that are not equipped to handle combative and violent patients may decide to discharge that patient from the nursing home and have the family or someone come get the patient.
The nursing home cannot just dump the nursing home patient out on the street but the nursing home staff can discharge the patient and refuse to allow them to stay there.
That is especially true if the nursing home is privately owned.
It's up to the nursing home as to whether or not they want to care for that patient.
If the nursing home refuses to take in a patient or take the patient back then all you can do is look for another nursing home that will take in the patient.