Allah created Earth so it can be a temporary home for us. However he has also created other planets such as Saturn and Mars. What are the purpose of these?

See these verses. It’s all for human beings to benefit. We may not know how

Holy Quran 14:32
——————
اللَّهُ الَّذِي خَلَقَ السَّمَاوَاتِ وَالْأَرْضَ وَأَنزَلَ مِنَ السَّمَاءِ مَاءً فَأَخْرَجَ بِهِ مِنَ الثَّمَرَاتِ رِزْقًا لَّكُمْ ۖ وَسَخَّرَ لَكُمُ الْفُلْكَ لِتَجْرِيَ فِي الْبَحْرِ بِأَمْرِهِ ۖ وَسَخَّرَ لَكُمُ الْأَنْهَارَ

It is Allah who created the heavens and the earth, and He sends down water from the sky and with it He brings forth crops for your sustenance. And He disposed the ships for you[r benefit] so that they may sail at sea by His command, and He disposed the rivers for you.

Holy Quran 14:33
——————
وَسَخَّرَ لَكُمُ الشَّمْسَ وَالْقَمَرَ دَائِبَيْنِ ۖ وَسَخَّرَ لَكُمُ اللَّيْلَ وَالنَّهَارَ

He disposed the sun and the moon for you, constant [in their courses], and He disposed the night and the day,

Holy Quran 14:34
——————
وَآتَاكُم مِّن كُلِّ مَا سَأَلْتُمُوهُ ۚ وَإِن تَعُدُّوا نِعْمَتَ اللَّهِ لَا تُحْصُوهَا ۗ إِنَّ الْإِنسَانَ لَظَلُومٌ كَفَّارٌ

and He gave you all that you had asked Him. If you enumerate Allah’s blessings, you will not be able to count them. Indeed man is most unfair and ungrateful!