Stomatal pores control leaf gas exchange and are one route for infection of internal plant tissues by many foliar pathogens, setting up the potential for tradeoffs between photosynthesis and pathogen colonization. Anatomical shifts to lower stomatal density and/or size may also limit pathogen colonization, but such developmental changes could permanently reduce the gas exchange capacity for the life of the leaf. I developed and analyzed a spatially explicit model of pathogen colonization on the leaf as a function of stomatal size and density, anatomical traits which partially determine maximum rates of gas exchange. The model predicts greater stomatal size or density increases the probability of colonization, but the effect is most pronounced when the fraction of leaf surface covered by stomata is low. I also derived scaling relationships between stomatal size and density that preserves a given probability of colonization. These scaling relationships set up a potential anatomical conflict between limiting pathogen colonization and minimizing the fraction of leaf surface covered by stomata. Although a connection between gas exchange and pathogen defense has been suggested empirically, this is the first mathematical model connecting gas exchange and pathogen defense via stomatal anatomy. A limitation of the model is that it does not include variation in innate immunity and stomatal closure in response to pathogens. Nevertheless, the model makes predictions that can be tested with experiments and may explain variation in stomatal size and density among plants. The model is generalizable to many types of pathogens, but lacks significant biological realism that may be needed for precise predictions.