"This is what Cyrus king of Persia says: "'The LORD, the God of heaven … has appointed me to build a temple for him at Jerusalem” (v1-2). The Israelites had failed to obey God, and they had lost their land. They were now ruled by the Persian Emperor Cyrus, who (history tells us) allowed his dependent colonies to worship their own gods and rebuild. Though still a conquered people, the Jews were permitted to return to Jerusalem and restore the Temple.
Our outward circumstances don’t determine whether we worship God. The Jews didn’t wait for perfect circumstances (like political independence); those “whose heart God had moved” eagerly returned to Jerusalem (v5).