They occur in response to joint surface damage, where the body tries ineffectually to heal the damage by absorbing bone from some areas, leaving holes or cysts, and then heaping it up in other areas, making bone spurs or osteophytes.
Small spurs are seldom a problem - rather they are just an X-ray indicator that there is an arthritic process going on inside the knee. But if the bone spurs do become large and symptomatic, they can be abraded away using a rotating burr (by arthroscopic abrasion or abrasion arthroplasty).
MRI-detected osteophytes of the knee: natural history and structural correlates of change. Zhu Z, Ding C, Han W, Zheng S, Winzenberg T, Cicuttini F, Jones G. Arthritis Res Ther. 2018 Oct 23;20(1):237.
Radiographic assessment of symptomatic knee osteoarthritis in the community: definitions and normal joint space. Lanyon P, O'Reilly S, Jones A, Doherty M. Ann Rheum Dis. 1998 Oct;57(10):595-601..