Elephants, or rather their feet, are sensitive to low frequency
vibrations, and they apparently communicate over long distances
through the ground using low frequency vibration - IIRC in the
Hz range. Humans may not be sufficiently sensitive to it. The
speed of sound will be much faster in solid ground than water,
so pressure waves would precede a tsunami. Perhaps the elephants
sense the disturbances in the ground caused by the quake or
tsunami and decided to head in the opposite direction. If one
stands by a roadway (particularly with bare feet), one can feel
the vibrations from cars and trucks. It's a normal phenomenon.