The primary function of CD59 is to protect host cells from complement-mediated damage. It achieves this by binding to the C8 and C9 components of the complement system, thereby preventing the assembly of the Membrane Attack Complex (MAC). This action ensures that the cells are safeguarded against potential lysis and destruction.