The US and the USSR got involved in this conflict because of their needs relating to the Cold War. During the Cold War, the two superpowers wanted to expand their power and influence as widely as they could. Therefore, they wanted to get involved in the Middle East. The Middle East was also important because of the amount of oil that is to be found in the region and because of its location, which puts it near to such important places as the Suez Canal.
When the Arab-Israeli conflict arose, it gave both superpowers the chance and the need to get involved. Once conflict erupted, it made sense for each of the superpowers to pick a side and use that side as a proxy (or at least to try to do so) in its own quest for dominance in the world.