The reason was fairly simple, to provide a sort of a counterweight against various sizeable minorities, particularly Germans and Hungarians, and a strong basis for an independent state after the fall of the Habsburg monarchy.
The two groups have mutually intelligible languages, are close culturally and have lived in close proximity for centuries. The earliest proponents of Czechoslovakism in the late 19th century have also pointed out historical ties such as the realm of Great Moravia which was indeed populated by various peoples including the two in question.
However, the idea of a Czechoslovak nationality is a somewhat artificial concept made prominent by the leaders of the independence movement, chiefly future presidents Masaryk and Benes, before and during the Great War for the reasons outlined above. The readily compatible nature of these ethnicities made it easy for an idea of a single nationality to be officially adopted, especially in light of the diverse population of the newly independent country.
According to the 1921 census, there were 8 759 701 Czechoslovaks (roughly two million of which were Slovaks) and 3 123 305 Germans in Czechoslovakia. This was a direct result of Czechoslovakia keeping its historical borders which included regions with a significant German population – Sudetenland. In Slovakia, the concept of Czechoslovakism helped counter the Magyarization of the region, as the Hungarians were in an even stronger position than Germans in Bohemia and Moravia when compared to the local populace.
The idea of the two peoples being a single nation was not without its opponents, however, and while it did take hold and was in fact an ideology enshrined in the constitution, in the end it was Czechs and Slovaks themselves who abandoned it. After the communists took power in 1948, the official stance turned away from the single nationality concept and in 1969 the Czechoslovak Socialist Republic was split into a federated state of the Czech and Slovak Socialist Republics.