 It's simply for the benefit of the colony. These injured ants learn to walk with five legs instead of six after a couple of hours and participate again in future colony tasks, go out hunting, foraging, and are a useful member of the colony.