There were many events that formed underlying causes to the establishment of the Warsaw Pact in 1955, but there were two that are directly related:
1) The creation of the North Atlantic Treaty Organization (NATO) in 1949
2) The addition of West Germany to NATO in 1955
NATO and the Warsaw Pact became distinct "enemies" of sorts, with NATO including most countries to the West of Germany and the Warsaw Pact including most countries to the East (these countries were known as the Eastern Bloc). NATO had been around for 6 years, but the addition of West Germany to the Western alliance system was seen by the USSR as a direct threat, leading to the Warsaw Pact.