What are some possible causes of a child having frequent illnesses, both viral and bacterial?

Poor diet.period. Poor diet affects immunity. Stop all forms of "junk", particularly the sweet stuff and get a well rounded multivitamin.
Define frequent ! Early childhood studies have shown us the average preschooler will have 5-7 respiratory and 3 diarrheal illnesses per year.Most are relatively minor and don't require an office visit.It drops to 5/yr total at school age. Most consider it a reflection of the child building its own immune system.Recurrent more serious illness can be a sign of an abnormal immune system or condition.