Soils are a hotspot of microbial predation, with numerous bacterivorous protists scavenging for bacterial prey. Despite this predation pressure, most functional genomic studies on soil bacteria are performed in the absence of trophic interaction partners. This biases our view on the selection pressures that shape bacterial evolution. Here, we aim to overcome this bias by studying how, under predation, selection affects B. subtilis' growth and survival. By screening thousands of genetic mutants with and without predation, we reveal that tens of different genes affect predation resistance, most of which have never been associated with predation before. We also show that mutations can rapidly emerge de novo and mostly occur in three loci only. These mutational hotspots either cause filamentation or biofilm formation and prevent protists from engulfing bacterial cells. Resistance however comes with a major cost. Mutants grow slower than susceptible cells and are rapidly replaced in the absence of predation. This strong antagonistic selection favors genetic regulation. Indeed, in one of the loci, we discovered a putative genetic switch that allows cells to switch back-and-forth between a slow-growing resistant state and a fast-grow susceptible state. We speculate that other cases of phase variation in B. subtilis can be linked to predation as well.