Pharmaceuticals can directly inhibit the growth of gut bacteria, but the degree to which such interactions manifest in complex community settings is an open question. Here, we compared the effects of 30 drugs on a 32-species synthetic community with their effects on each community member in isolation. While most individual drug-species interactions remained the same in the community context, communal behaviors emerged in 26% of all tested cases. Cross-protection during which drug-sensitive species were protected in community was 6 times more frequent than cross-sensitization, the converse phenomenon. Cross-protection decreased and cross-sensitization increased at higher drug concentrations, suggesting that the resilience of microbial communities can collapse when perturbations get stronger. By metabolically profiling drug-treated communities, we showed that both drug biotransformation and bioaccumulation contribute mechanistically to communal protection. As a proof of principle, we molecularly dissected a prominent case: species expressing specific nitroreductases degraded niclosamide, thereby protecting both themselves and sensitive community members.