Bacteria are able to adhere to sugars (e.g. mannose) on the exterior of eukaryotic cells, leading to infection and disease. Why have eukaryotes not evolved so as to dispense with sugars on their cell surfaces? I assume there must be a positive aspect to having these sugars. What is it?
In fact, the variation of the sugars in certain cell-surface antigens (blood group antigens and histocompatibility antigens may represent the kind of evolutionary response to infectious agents mentioned in the question. The situation with the major histocompatibility antigen is complex, but variation in blood group antigens is thought to be a response to the malaria parasite — reviewed by Cooling.
I'd look on it from the other side. Thoose structures have certain purposes, such as stability or signaling purposes. Due to their short doubling time compared to most cells of more complex organisms, bacteria is able to adjust to changed condition rapidly and therefore adapts to it's environment. (Just think of mechanisms of resitance to antibiotics: plasmids for example with the information for β-lactamase ere exchanged even between differnet kinds of bacteria) It would therefore not make a lot sense for the slower cells to adjust their usefull structures in order to avoid bacteria, which change way faster.