In the 1500s the Ottoman Turks took power over much of the Middle East, then four centuries later the region's strongest influence shifted to the European powers as Ottoman Turkey found itself on the losing side of WWI and were unable to control its Arab colonies. Jordan didn't escape the control of foreign rulers until they gained independence from Britain in 1946.
In 1947 Israel was created and Jordan, among other countries, protested this action. Despite a battle, the Arab countries accomplished little and Jordan became a destination for fleeing immigrants from the Palestinian Territories. In 1967's Six Days War, Egypt pressured Israel, which resulted in their loss of the Sinai Peninsula and Jordan's loss of the West Bank and their share of Jerusalem.
Over the next 20 years or so the Middle East was unstable as power shifted to the oil-rich Gulf Coast Countries, yet somehow through this process, Jordan remained fairly neutral and relatively unaffected by the drastic changes taking place in neighboring Iran, Iraq, and Egypt. In 1993 there was finally a truce between Israel and the Palestinian Territories and the following year, Jordan signed a formal peace treaty with Israel.
Since the 1990s, peace with Israel seems far from certain, but Jordan has maintained an open border with Israel, while balancing their commitment and support to the Arab world. Additionally, there are multiple Palestinians in Jordan, yet the government has maintained peace by expelling radical Palestinians who threaten Israel's existence and Jordan's pact with Israel.