It would depend on what they had done to end up in prison, and why they had done it. My reasons for visiting might vary too.
Regarding what they did, my view is that the law in most countries has been so debased and has become so detached from any coherent moral framework that it is utterly impossible for a rational person to make a blanket judgement about people who break it. I don't draw a definitive dividing line, and there are some people I would visit regardless of what they did, even if only to try to understand better what lead them to that point.
Regarding why, their reasoning would probably be the most important factor to me. I wouldn't argue that the right reason would justify someone's crime, but it might make it understandable. I firmly believe we are all capable of doing morally questionable, or even outright heinous things under the right circumstances and if someone I cared about committed an awful crime but I could understand or even sympathise it would be a factor.
For example, someone you care for commits a murder, unquestionably wrong, but imagine two different scenarios. In Scenario A the individual in question becomes obsessed with an acquaintance, abducts and murders them just for the pleasure of ending their life. In Scenario B they believe someone is going to attempt to kill them or someone they love, they go to the police who don't take them seriously, so they decide to strike first, wait outside their house and shoot them when they leave for work. Both scenarios are cold-blooded, premeditated murder, but, if that were your loved one could you honestly say you wouldn't feel differently depending on which it was?