I can't really say if it is or not a punishment from Allah. Earthquakes can also be sign of Akhirah coming near.
But Earthquakes can also be a form of punishment which Allah can give according to Islamic Faith. Earthquakes are also signs of Allah of being the Mighty Creator and in whose powers is life and death.
Abu Musa reported: The Messenger of Allah, peace and blessings be upon him, said, “This nation of mine has been granted mercy. Their punishment is not in the Hereafter. Their punishment is in the world through persecution, earthquakes, and slaughter.”
Source: Sunan Abī Dāwūd 4278
Grade: Sahih (authentic) according to Al-Albani
For me, Earthquakes on Muslims is a trial by Allah for patience and to get forgiveness through calamity.