At the time of Jesus a market was allowed to reside in the outer court. It was the placed where sacrificial animals could be bought, foreign currency could be exchanged for sacred money, and where sacrifical doves to offer at the temple could be bought by those who were poor. It is highly likely that within the court Mary and Joseph purchased two doves as an offering when they presented baby Jesus before God (Luke 2:22 - 24).
The outer court was also the place where Christ, at the beginning and near the end of his ministry, drove out the "money changers" and others from the temple (John 2:13 - 16, Matthew 21:12). It is also highly likely that the outer court was the place where Apostle Paul's appearance caused a riot and almost got him killed (see Acts 21:27 - 32).
The idea for Jerusalem's temple originated with King David. Although he wanted to build it, God only allowed him to gather building materials. It would be left to David's son King Solomon, who would be blessed with being the wisest man who would ever live, to construct God's house in Jerusalem (2Samuel 7:4 - 6, 12 - 13). The reason WHY God did not allow David, a man after his own heart, to build his house was that he was a "bloody man," meaning he caused quite a bit of bloodshed in his life through wars and battles (1Chronicles 22:6 - 8)
Solomon began his reign over Israel in 970 B.C. and began work on the building four years later (966 - 965 B.C.). He built "the house of God" on the east side of Jerusalem where Abraham was to offer Isaac as a sacrifice (Genesis 22:1 - 14). The structure was completed in 959 - 958 B.C.
After Solomon's death Israel split into two major pieces - the Northern Ten Tribes of Israel and the Kingdom of Judah. The Northern kingdom lasted until 723 B.C. The kingdom of Judah lasted until 586 B.C. when it was conquered by Babylon. It was Babylon's King Nebuchadnezzar who burned, pillaged and destroyed the temple in Jerusalem and carried all of its treasures away to Babylon.
The second (or Herod's) temple was built in the same location as the first. When Herod the Great became king of Judea the unfinished structure had stood for about five hundred years. Herod, desirous of gaining the favor of the Jews, proposed to rebuild it.
Ultimately, the need for an earthly sanctuary in Jerusalem was fulfilled and brought to completion by the sacrifice of Jesus Christ, which ended the Old Covenant and the need for a physical priesthood. Under the New Covenant, the spiritual temple of God is in heaven where Jesus Christ is High Priest and has superseded any physical one on earth.