At this time, you will remember that Israel has developed a habit of associating God's presence with a particular building and location. The temple that Solomon built became that focal point. They could not really function in their relationship with God without it. I believe that it was God's intention to wean the people away from such a practice, but, as we also know, the kings and leaders were for the most part not following God. The temple was a tangible reminder of God's presence and desire to bless ... if they followed him.
The kings continued to disobey God and continued to encourage the people to disobey God. And when God led the people into this land, God promised that if they stopped obeying, one of the things he would do was allow a foreign army to conquer them. And one finally did. But God also promised that, after a while, he would redeem and restore Israel.
At this time, conquerors developed a method of assimilating subjugated peoples into their kingdoms. They forced people to move. They forced people to live hundreds of miles away from their homeland. Without cars, trains and planes, hundreds of miles was almost insurmountable. They mixed the conquered peoples together.
And that is what happened to Israel. The conquering army destroyed the temple, leveled Jerusalem and moved the people a long ways away.
Sometimes, God tells one of his servants what he is going to do in the future. And he did tell one of them how he was going to redeem and restore his people ... using a different invading army to conquer those who conquered Israel. And that servant wrote what God showed him down. So, when a new king did conquer, Israel told him how God prepared the way and worked for him. And they showed him what god's servant had written. The king was impressed and he let the people return back to Jerusalem and their homes.
With different waves of migration, Israel rebuilt Jerusalem and the temple.
Remember, Israel had gotten used to associating meeting God with being at a specific place. So, when the temple was destroyed, the connection to God was disrupted. They were unable to connect to god with the same closeness and the same reality. So, when the temple was rebuilt, the connection was re-established in a vital way. Imagine how the burdens of hearts were relieved. There was a vivid sense of God's nearness and a rush of joy.