If a unit is engaged in hand-to-hand combat and it panics then the normal Flee and Pursuit rules apply. The fleeing unit can therefore be pursued if its enemy won the preceding combat, and consequently the fleeing unit may be destroyed in the same way as a unit which breaks following defeat in combat. If the enemy did not win the previous combat (or if the two have not yet fought for some reason) then the enemy cannot pursue.
Note that a unit which panics and flees from combat does not cause other units to panic as a result (ie, because friends break from hand-to-hand combat within 12"). A test is only required for friends that are defeated in combat and then broken as a result.