Actually, we don't know. Perhaps hemophilia genes could confer resistance to some undiscovered diseases. Besides, a combination of seemingly deleterious genes could actually give place to a new, more adaptive organ or structure. For example, the trunk of the elephants must have looked like a deformity at the very beginning, but afterwards it became a useful structure.