Healthy plants in soil that is rich in organic matter and nutrients, and that are watered correctly with plenty of sunlight and airflow, are much less susceptible to pests. In contrast, sickly plants struggling in depleted soil, that are treated with chemical fertilizers, are much more likely to have pests.
Test soil at least once a year to determine soil fertility and pH. When the nutrient levels and soil pH are correct, this prevents stress which then reduces pest problems. This is the soil test kit I use.