In the Old Testament narrative, Yahweh, the one "true" god, commanded the tribes of Israel to worship only him and follow his laws. As the Israelite state became more prosperous through trade with other nations, foreign gods gained influence and many ancient Jews "played the harlot" with these alien deities.  In retribution, Yahweh allowed the Babylonian Empire to defeat the Israelite army and cast the ruling elite into exile. Eventually, the exiled Jews realized their folly, and were allowed to return to their homeland to ensure their people would follow God's laws forever after. Unfortunately, this narrative completely whitewashes the actual history of religion in Israel.
The Original Religion of the Jews
Biblical archaeology does seem to agree with the Bible in one respect: the ancient Israelites did worship other gods besides Yahweh. However, the major point of disagreement is that archaeological evidence shows these gods weren't foreign at all. In fact, the most common view among scholars is that the ancient Hebrew religion was originally polytheistic. Furthermore, Yahweh was originally a subordinate deity to the god El.
The Ugaritic Texts
Ugarit was an ancient Canaanite city-state that rose to prominence around the 12th Century BCE. In 1928 multiple stone tablets from between 1300-1200 BCE were discovered, and our understanding of Biblical history hasn't been the same since. These tablets detailed much about the pantheon of gods which were central to the religion of the area. El was the chief god, who created the world and ruled over all of the other gods; such as, Baal, Yam, Mot, Yahweh, and Asherah (El's wife). What's most interesting about these texts is that many stories and acclamations regarding these deities are mirrored almost exactly in parts of the Old Testament, except their names were replaced with references to Yahweh in the Bible. Clearly, this was an attempt by the Bible's authors to simultaneously wipe out the history of the old gods, and prop up the last god standing: Yahweh.
Yahweh was originally a war god from southern Canaan who gained prominence when Saul, a follower of Yahweh, became the first king of Israel. Given his position as the primary deity of the monarchy, Yahweh eventually superseded El as the king of the Gods and even became the consort of El's wife, Asherah. Given El's previous importance, he left a significant mark on the language used by the Israelites in their holy scriptures. In the Bible, Yahweh is referred to as El, El Shaddai, El Elyon, and El Berith, and even the name "Israel" means "struggled with El."
The Shift to Monolotry
In much of the Old Testament, statements such as "Thou shalt have no other gods before me," (Exodus 20:3) imply that the ancient authors weren't opposed to the idea that other gods existed. In fact, there was a point in ancient Israelite history where polytheism turned to monolotry, which comprises a belief in many gods, but the worship of only one. It is not clear what led to this change, but it is very likely there were political motivations. After all, it was King Josiah who outlawed the worship of other gods in 2 Kings 23, and Yahweh was the official god of the monarchy. Thus, it is possible he did so in order to gain greater political control.
It's interesting to think that the ancient Jews believed polytheism led to their exile to Babylon, since it occurred only 12 years after King Josiah's death, yet they needed an explanation. During the battles with Babylon (and earlier Assyria), the political and religious elite believed that while Israel was weak, her god was the most powerful. However, once defeated, the idea that Yahweh could be bested was not something they were willing to accept. Instead, they reasoned that Yahweh was the only god that had ever existed, and he helped the Babylonians defeat the Israelites as punishment for "playing the harlot" with other gods. They also concluded that Yahweh willed them to return to Israel and enforce a purely monotheistic religion. It was at this point that many portions of the Old Testament were written, such as Jeremiah, 2 Kings, 2 Chronicles, Ezra, Daniel, and the Book of Judith. In fact, many scholars believe that a great deal of the Old Testament was compiled during and after the Babylonian Exile, which would account for the exclusion of Israel's true polytheistic past in much of the Bible.
Many followers of the Abrahamic religions believe their religion sprang from a unique tradition that could have only ever been inspired by the one true god. However, the ancient Israelite religion was not much different than that of the ancient Greeks or Egyptians. Yahweh was originally a god very similar in nature to the Greek god Ares, yet as the cultural climate changed, he was promoted to a more Zeus-like position. As time went on, and despite what the Bible says, cultural forces again changed his nature to become the sole-existent deity we know today. This is how the god of the Jews, Christians, Muslims, and Deists came about: it was simply a matter of cultural evolution.
Fantastic video detailing the history of Israelite religion:
Great book about the cultural forces leading to Monolatry, Monotheism, Christianity, and Islam:
Good article about Yahweh's consort Asherah:
Great description of the Ugaritic Texts:
Wikipedia does a good job describing the history of Yahweh: