The first idea is that the animals have a sixth sense. They know when the earth is going to shake. The second idea is that the animals have a more acute sense of hearing. This helps them to hear or feel the earth’* vibration. In this way they sense the coming disaster much before the human beings. So they run away to safer places.
This is scientifically proven that anmial can hear the approaching natural disturbances as they can hear sound with low frequency which we can't. This idea is more reasonable.