In 1979 the Iran state had their revolution and became an Islamic state. During this time period Saudi Arabia was the leader of the Muslim world with it's the holy cities of Mecca and Medina.
The soviet influenced the Arab Cold War between Saudi Arabia and Egypt under Gamal Abdel Nasser. The alliance acted as a moderating influence on Saudi-Iranian relationship with other Arabian countries
The main cause of the current tensions is related to the proxy confrontation between Iran and Saudi Arabia. Saudi Arabia was a key financial backer of Saddam Hussein during his 1980-1988 war with Iran.
With Iraq weakened following the 1991 Gulf War, Saudi Arabia and Iran became the two main regional powers. The Iranian revolution of 1979 and the advent of the Islamic Republic was a double threat to the conservative Sunni monarchies of the Arabian Peninsula.
The 2015 nuclear deal between Tehran and six world powers which made Riyadh fear was a step towards ending Iran's international isolation. Saudi Arabia's air defense near Riyadh intercepted and destroyed a missile fired from Yemen, where a Saudi-led coalition is battling Iran-backed Shiite rebels.