Well, to understand this we have to go back to around the mid-19th century. After the end of the Holy Roman Empire, the German Confederation was created. This constituted culturally German and German speaking lands as a substitute to the Holy Roman Empire, which itself was a majority German area. Many movements wanted to unify the German confederation, which was a group of states which included Bavaria, Austria and Prussia. One of the debates of the unifying forces was whether or not to include Austria. This was because much of Austria's land was outside of the German confederation, including Hungary and parts of Italy.
The works of Otto von Bismarck pushed away Austria, and in 1870 and 1871 he started a war with France. This spurred on nationalism that precipitated the states of the German confederation, barring Austria, to unify into a German state. World War I then occurred some forty years later and, after, Hitler came to power. Hitler hoped to bring together all German peoples, and the first goal for this was Austria. For a very long time there was a movement to make Germany and Austria part of a unified Reich. This was played on, and in 1938 the two countries were unified.
The two countries were not so different. They spoke German and were much alike to people in Germany.