The AI tends to not consider Friendly Fire from what i see. If it did, your own towers wouldn't hit defending troops on the walls, and the AI would try to not fire into their own men's back as much.