This verse has reference to the Lamanites who had attacked the city of Ammonihah. It is a slightly different perspective of the battle than we have from Alma 16:8 where the Nephite victory appears more decisive. In this verse it is made to appear that the Lamanites retreat more than that they are defeated. Both verses are likely accurate, in that the retreat followed the clear defeat. Alma 16:8 indicates that the captives that were taken from Ammonihah were re-taken. With the loss of the captives, the reason for the attack was nullified, and the Lamanites had no more reason to engage in a battle that they were losing.
Alma 16:12 indicates that there was peace for three years, and then another confrontation in the fourteenth year of the judges. This battle is the one that will be discussed in Alma 28 and end in the fifteenth year of the judges (see Alma 28:9). This correspondence between the subsequent battles firmly places this reference at the time of the retreat from Ammonihah.
The other possibility would be that it refers to the battle against the Anti-Nephi-Lehies, but since the Lamanites are returning to the land of Nephi, and the battle against the Anti-Nephi-Lehies took place in the city of Nephi, it cannot reasonably be assigned to that event.