This Battle of Megiddo is recorded as having taken place in 609 BCE when Pharaoh Necho II of Egypt led his army to Carchemish (northern Syria) to join with his allies; the fading Neo-Assyrian Empire, against the surging Neo-Babylonian Empire. This required passing through territory controlled by the Kingdom of Judah. The Judaean king Josiah refused to let the Egyptians pass. The Judaean forces battled the Egyptians at Megiddo; resulting in Josiah’s death and his kingdom becoming a vassal state of Egypt. The battle is recorded in the Hebrew Bible, and the writings of Josephus.

While Necho II gained control of the Kingdom of Judah; the combined Assyrian-Egyptian forces lost to the Babylonians at the Fall of Harran; after which Assyria largely ceased to exist as an independent state.
Battle of Megiddo According to the Biblical Accounts
The basic story of the Battle of Megiddo is told in 2 Kings 23:29–30 (written c. 550 BC). The Hebrew text here has been misunderstood and translated as Necho going ‘against’ Assyria. Some Biblical scholars note that most modern translations try to improve this passage by considering what we now know from other historical sources; namely, Egypt and Assyria were then allies. The original text also does not mention a ‘battle,’ yet some modern versions add the word ‘battle’ to the text.
In his days Pharaoh Neco king of Egypt went up to the king of Assyria to the river Euphrates. King Josiah went to meet him; and Pharaoh Neco slew him at Megiddo, when he saw him. And his servants carried him dead in a chariot from Megiddo, and brought him to Jerusalem, and buried him in his own tomb.
There is a more extended account of the Battle of Megiddo recorded in the Bible:
After all this, when Josiah had set the temple in order, Neco king of Egypt came up to make war at Carchemish on the Euphrates, and Josiah went out to engage him. But Neco sent messengers to him, saying, “What have we to do with each other, O King of Judah? I am not coming against you today but against the house with which I am at war; and God has ordered me to hurry. Stop for your own sake from interfering with God who is with me; so that He will not destroy you.”
However, Josiah would not turn away from him; but disguised himself in order to make war with him; nor did he listen to the words of Neco from the mouth of God, but came to make war on the plain of Megiddo. The archers shot King Josiah, and the king said to his servants; “Take me away, for I am badly wounded.” So his servants took him out of the chariot and carried him in the second chariot which he had, and brought him to Jerusalem where he died and was buried in the tombs of his fathers.
II Chronicles 35:20–25.

Location of the battle of Megiddo
A view at the topography of the place around the city; will reveal that Megiddo is a small rise among others on a small elevated plateau close to a large level coastal plain large enough to accommodate many thousands of troops. Being that it doesn’t dominate the surrounding area, it is not an obvious target, yet it is useful as a garrison, and it has a water source from the river Kishon. This explains why Josiah used the terrain to mask his approach as he attempted to ambush the Egyptian army on its way to attack the Babylonians in Mesopotamia.
Judah fell under Egyptian control and influence. On his return from Syria and Mesopotamia, Necho II captured and deposed Jehoahaz, the son of Josiah, who had just succeeded his father on the throne. The pharaoh enforced a tribute of 100 talents of silver (about 33⁄4 tons or about 3.4 metric tons) and a talent of gold (about 34 kilograms (75 lb)) upon the kingdom. It appointed Jehoahaz’s older brother Eliakim as king. Necho also changed the name of this new king to Jehoiakim. Jehoahaz was taken captive to Egypt, where he became the first king of Judah to die in exile.