Are they just to light up the night? Does the bible even talk about other planets and other solar system with the capability of life or the people who wrote the bible does not know about these solar system because of lack of scientific advancement at that time?
The Bible does recognise the existence of heavenly bodies of some sort, and the fact that they move and come and go during the year:
Gen 1 14 And God said, Let there be lights in the firmament of the heaven to divide the day from the night; and let them be for signs, and for seasons, and for days, and years.
However it calls them lights, which is how they appear from the earth. There is no reference to planets or other such worlds.
There was astronomy in late Biblical times: the Wise Men followed "a star" at the time of Jesus' birth. However the difference between astronomy and what we now call astrology was not clearly defined, and technology had not developed to the extent that Jupiter (the largest and most clearly-featured planet) could be seen to have coloured bands or moons. It was Galileo who first observed its moons, and he got into serious trouble for documenting it and supporting Copernicus.
We may say the Bible is incomplete in describing the heavenly bodies as lights rather than being more specific; but it was written by the writers of the time — they could not be expected to write down what they could not have understood.
They are just there to display the glory of God.
The heavens declare the glory of God; the skies proclaim the work of his hands. (Psalm 19:1, NIV)
When we look at the sun, the moon, solar systems, galaxies, we see how great is our God and how big is our God. The universe declares the glory of God. The more we know about the universe, the more we are awed by the greatness of our God. Louie Giglio gave a sermon on the universe - "Indescribable (YouTube)", explaining that we can see the glory of God by simply looking at the universe. Here is one quote from the video (source) -
“We haven’t built a big enough telescope yet to see exactly what is out there that God has created, but every time we build a bigger telescope we’re ‘Wowed’ once again, that it’s (the universe) bigger than we thought. There’s more amazing stuff out there that we have never seen, and God is laughing all over again going ‘Yeah, congratulations. Is that all you’ve got? Go back and build a bigger one and I’ll show you something else that you haven’t seen yet.”
Here is an obscure answer that appears to have surfaced in the mid-1800s:
The purpose of the greater universe i.e. “stars etc.” is addressed in: Witness of the Stars, by E. W. Bullinger
Essentially, Bullinger along with others advanced that God in creation established the “Gospel” message in the stars. He goes into great detail within his book to show how the constellations depict the birth, death and resurrection of Jesus Christ. He believed that the stars proclaimed the same truth that we now have in the Bible. Therefore, mankind has never been without the Word.
He also used Psalms 19:1 as one of his proof verses:
The heavens declare the glory of God; the skies proclaim the work of his hands.
Archeologists have discovered multiple mosaic floors in ancient Synagogues that depict the zodiac along side illustrations of Biblical stories. Most historians assume that this is evidence of the Israelites chasing after pagan gods. However, it could indicate that Bullinger was correct and these early depictions are remnants of divine understanding from an earlier time.
This answer is not without controversy, many have and still challenge the legitimacy of the message in the stars perspective. However, modern archeology and their discoveries of astrological signs within ancient synagogs and early churches may cause a resurgence of interest in this obscure perspective.
As to the purpose, Psalm 19 tells us that they, like all of creation, declare the glory of God: See also: God has created all things to bring glory to Himself.
1 The heavens declare the glory of God; the skies proclaim the work of his hands.
2 Day after day they pour forth speech; night after night they reveal knowledge.
3They have no speech, they use no words; no sound is heard from them.
4 Yet their voice goes out into all the earth, their words to the ends of the world. In the heavens God has pitched a tent for the sun.
5 It is like a bridegroom coming out of his chamber, like a champion rejoicing to run his course.
6 It rises at one end of the heavens and makes its circuit to the other; nothing is deprived of its warmth.
As for the lack of scientific knowledge, and the ability of those that were inspired by God to write down His words, it's clear that they had knowledge that was unknown to science at the time.
On the matter of extra-terrestrial life and the possibility including planets capable of supporting life, the Bible is silent. I try not to speculate beyond that.
planet is not found in the bible. In ancient times, there were stars and wanderers. Wanderers are planets, named this way because they didn't move like the other
"stars" heavenly bodies. Few understood the difference between a star and a planet. Please consider reading the lyrics of "Nearer my God to thee" - also know that in that song, the cross is not a crucifix but Jacob's ladder.
Please consider reading this regarding ancient times and planets - extra-biblical.
I know that I'm going to catch some flack for this comment, but it needs to be said to help answer this question. The bible is full of truths, but that doesn't mean that there aren't truths that exist outside of the bible. The Bible doesn't talk about the internet, subatomic particles, or how to calculate volume (Leibniz) or acceleration (Newton). That doesn't mean that they do not exist. It means it is out of scope for what the bible is - inspiration for daily living.
I believe it was Old Testament scholar Meredith Kline who suggested that the Tabernacle/Temple plan illustrated the whole of creation in microcosm, including the planets.
It starts with the court of the Gentiles and gets more exclusive the further you go in. In the main grounds, you have a picture of the earth with the laver representing the sea and the horned altar the horns or peaks of the mountains (the identification is easy to see in Hebrew, I am told, because the words are the same).
As you you enter the Holy Place, you go further up and further in, as it were, entering the heavens. There is the lampstand with the main pole plus three branches on either side, making seven lights in all. These represented the seven moving lights in the heavens (sun, moon, and the five planets visible to the naked eye -- Mercury through Saturn).
Beyond this is the Holy of Holies, which is the dwelling place of God.
Thus, the temple is a picture of the whole creation under God.
As for the purpose of the planets and the whole of the universe for that matter, others have noted well that the purpose of all creation is to declare the glory, power, majesty of God -- without words. Note that the locus classicus for this view is Psalm 19, which is divided into two halves: God's glory declared without words and God's glory in his perfect word.
I leaned on Gordon Hugenberger's sermons on Psalm 19 for this answer.