Did he? Would most generals of antiquity fight alongside their men, was it common to see happen?
According to Livy, Book 21, Chapter 4:
[Hannibal was always the first choice] whenever courage and determination were needed; and there was no leader for whom the soldiers held greater affection or showed more daring. Most fearless in seeking danger; most calculating in the presence of danger, no amount of exertion could tire his body or soul; heat and cold he endured equally. Food and drink were determined by his needs, not his desires. His times of sleep were not set by day or night; he rested when he had finished his work, but he did not seek that rest on a soft bed or in silence – men often saw him lying on the ground amongst the guards and outposts, wrapped in his military cloak. His dress was in no way superior to that of his comrades; only his weapons and his horses. He was by far the best both of the cavalry and the infantry, the first to enter the fight and the last to leave the field.
Granted, this is not entirely reliable. The "non-historical" sources of the ancient world (epic poetry, plays, etc) war tended to be portrayed in a sort of heroic light, with famous duels between the leaders and bold pre-battle speeches. It is entirely possible that Livy was picking up on that tradition and imposing it on his history.
That being said, leading from the front was certainly something many generals of the ancient world did. Alexander the Great, for example, sustained several near fatal wounds due to his "heroic" way of conducting battle, and the Persian prince Cyrus the Younger died when he tried to initiate a duel between him and his opposing number. So it is really a tossup what you believe.
Well in Scipio Africanus, Rome's Greatest General most of Hannibal's battles are examined in detail and unless i'm badly misremembering, there is no mention of Hannibal ever engaging in physical combat himself or even putting himself in a position where it would be likely.
Which seems to make sense. It would be a lot harder to be cognizant of the overall tactical situation and to attend to a general's responsibilities from the front ranks as opposed to if you were on horseback in the rear. It's also hard to image that Hannibal could have escaped his defeat and following route at Zama if he was fighting with his troops.