We find that Bacillus subtilis bacteria in a growing colony exhibit large (non-thermal) number fluctuations. Also, these swimming bacteria are observed to form dynamic clusters where the orientational correlations of bacteria within a cluster are scale invariant. Studies of another rod-shaped swimming bacterium found commonly in soil, Paenibacillus dendritiformis, reveal that neighboring colonies secrete a previously unknown toxic protein, Slf, which is not secreted by the bacteria in isolated colonies. Some bacteria within a colony survive by switching their shape from a rod to an immobile Slf-resistant spherical shape. If these spherical bacteria later encounter sustained favorable conditions, they secrete a signaling molecule that induces a switch back to the rod-shaped form. The genes that encode the switching pathway are widespread among bacterial species, suggesting that this survival mechanism is not unique to P. dentritiformis.