During the time of ancient warfare, many empires were using military animals to supplement their armies prowess. Everyone has heard the stories of giant elephants that made up the ranks of the Persian armies. Well as always your enemies will find a countermeasure and invest in how they can defend themselves against your deadliest weapon.
This what the Roman army did when facing war elephants, they would use their own war pigs. You may think why would a huge elephant be scared of a pig, well actually elephants really dislike the squealing sound pigs make. This notably would cause them to stampede and trample over the army. Of course, it was not just your typical pig they would employ, they would use wild hogs and savage boars.
It was Alexander the Great who first learned that elephants are scared by the smallest squeal of the hog. He used this during his campaign in India against Porus and then there was also the Roman Empire. Of course, the Romans were one of the most tactical and advanced military forces of their time so it was only normal that they knew about the war pigs advantage over elephants.
During their campaigns in Pyrrhus in 275 BC, they effectively fought against massive war elephants using pigs to scare them into trampling their own armies. In fact, they also reported that during the siege of Edessa, the defenders even hung down squealing pigs to scare away siege elephants.
Of course, this was not their only use in warfare, in 266 BC, there were reports Antigonus II using flaming pigs as a sort of crude bomb to launch over city walls. Not very animal-friendly and a very cruel practice, but it proved to be a savage tactic setting houses and people on fire and causing massive panic.