Most cases of perianal abscesses (abscesses close to anal opening) are sporadic, though there are certain situations which elevate the risk for developing the disease, the ones I already mentioned, diabetes, Crohn's disease, steroid use that suppress the immune system.
Timely and appropriate treatment is most important to avoid relapses and complications.
Try to avoid constipation, use gentle techniques to clean the anal area, wash the anal area after every bowel movement, and keep the area dry.