Our teacher, the Rema, wrote in section 2 (Shulchan Aruch Yoreh Deah 335:2): There are those who say that a hater may go to visit a sick person, but it does not seem so to me. Rather, one who is his hater should not visit a sick person, nor comfort a mourner, so that he should not think that he is rejoicing in his misfortune, and it is nothing to him but distress. Thus far his words. However, everything is according to what the hatred is, and according to who the haters are (Shach, subsection 2). But if a hater died – one may escort him, for in this "rejoicing in his misfortune" is not applicable, as this is the end of all man (ibid.). And so too, if the hater sends word to him beforehand that he wishes to visit him or comfort him, and he gives him permission – it is permitted. And on the contrary, through this, peace is made between them. Therefore, there are those who wrote that now it is the custom that the hater goes, for it leads to peace (Ba'er Heitev in the name of the Keneset HaGedolah and Sefer HaChaim, see there).
כתב רבינו הרמ"א בסעיף ב (שולחן ערוך יורה דעה שלה, ב): יש אומרים דשונא יכול לילך לבקר חולה, ולא נראה לי. אלא לא יבקר חולה, ולא ינחם אבל, מי שהוא שונאו, שלא יחשוב ששמח לאידו, ואינו לו אלא צער. עד כאן לשונו. ומיהו הכל לפי מה שהיא השנאה, ולפי מה שהם השונאים (ש"ך סעיף קטן ב). אבל שונא שמת – יכול ללוותו, דבזה לא שייך שמח לאידו, באשר הוא סוף כל האדם (שם). וכן אם השונא שולח לו מקודם שרוצה לבקרו או לנחמו, והוא נותן לו רשות – מותר. ואדרבא מצד זה נעשה שלום ביניהם. ולכן יש שכתבו שעכשיו נוהגין שהולך השונא, דמביא לידי שלום (באר היטב בשם בה"י וספר החיים, עיין שם).