Ammonia and ammonia-based fertilizers can adversely affect earthworms. Annual use of ammonium sulfate, anhydrous ammonia, and sulfur-coated urea has been shown to decrease earthworm populations (Edwards et al., 1995).
Is anhydrous ammonia bad for soil?
If applied properly, anhydrous ammonia continues to be an excellent source of nitrogen. There is not research to suggest that this product has a negative effect on soil properties.
Does anhydrous ammonia kill soil microbes?
What does happen, both notes, is that anhydrous ammonia typically wipes out fungi and bacteria in a zone about 3 inches in diameter at the tip of the injection point. Compared to the overall mass of soil in the field, it's a tiny amount. As far as earthworms, if the knife slices one in two, yes, it will kill one.