I think there's a very fine that's often difficult to walk.
Of course we might be able to love someone who treats us badly - all the more if this behaviour is down to illness (mental or physical). I cared for a family member for a while, and the treatment I received on occasion was actually cruel and very painful: The hostility, the emotional blackmail. Still, I could do it because I knew it was down to the circumstances, and I also knew the person was not like this at all when they were still healthy.
Even in a situation like that, the carer needs a supportive network, other people who can help, and most of all: They need to look after their own emotional, mental and physical health. It's not for nothing that support groups for e.g. carers, family members of cancer sufferers, or addicts exist. Even if the other person is ill/sick: The lines between what is still healthy behaviour and codependency can become blurred quicker than you might think.
You help no one if your own health goes down the drain, and sometimes, you just have to say: "Stop!" And if need be, admit that you can't do it anymore. You don't have to prove to anyone that you're strong enough to take it, that's a lot of crap. It takes strength to admit weakness - sadly a lot of people don't understand that at all.
These cases however are completely different from unhealthy personal relationships, where one person treats the other like shit, and the other just takes it but feels miserable about it. You don't need to stay with anyone who doesn't respect you. If you feel you need to, I would again question if there's some sort of (co)dependency going on.
Being single is a million times better than staying with someone who treats you badly, just for fear of being alone...