Not like why they were due to WW2 I mean before that. Why are there two German speaking states?
A better question than "Why are there two German speaking states"[1] is "Why are there only two German-speaking states, given how many there used to be?" At the height of the Holy Roman Empire,[2] there were, depending on how one counted them, at least a hundred but perhaps as many as 1,800 German-speaking states or varying sizes. What happened over the course of several centuries was the consolidation of these states into a smaller number of larger states.
So if you start with hundreds of German-speaking states, the question now becomes how they ultimately came down to only the big two of which you speak. The answer is a combination of factors, but the process it is at least begun by the Protestant Reformation, which establishes Protestant rule in the northern part of the HRE and contributes to the rise of states in that region -- mainly Prussia but also Saxony. Although these states remain in the HRE, they nevertheless begin to assert separate identities that grow over time.
The rise of Napoleon and his conquest of German-speaking territory is the next big factor. Napoleon's conquest of Central Europe has two main results: dissolution of the HRE, with Austria emerging as an empire in its own right; and the creation by Napoleon of the Confederation of the Rhine, with the independence of the remaining German states no longer under control of the HRE or Confederation. Prussia essentially emerges as a "third Germany" at this point.
Since the Confederation is a Napoleonic creation, it is dissolved after he is defeated, but there is a realization among many German elites that a lack of political unity has resulted in victimization at Napoleon's hands. As a result, new German confederations are created that evolve over time both to increasingly centralize power (mainly in the hands of Prussia) and to exclude southern parts of German-speaking Europe.
For some time, a debate rages among nationalists regarding whether the envisioned -- and finally, in 1871, realized -- German Reich should include Austria or not. Ultimately, Bismarck, who is leading the drive for unification, decides against it, and the two-state formula is what results. Germany as Bismarck creates it has a slight Protestant majority concentrated in the north but is largely secular; Austria, in contrast, is overwhelmingly Catholic in population and will have a "special relationship" with the Vatican for much of its history.
Two good books on the topic are Pieter Judson's The Habsburg Empire and Katja Hoyer's Blood and Iron.
---
[1] There are at least three German-speaking states today -- Germany, Austria, and Liechtenstein. However, if you add countries with Germany as an official language, you get six by adding Switzerland, Luxembourg, and Belgium. Finally, France and Italy both have large German-speaking populations in border regions that, before WWI, were parts, respectively, of Germany and Austria.
[2] I realize it might be confusing why the HRE wouldn't just be considered a single state. However, when one considers the sheer size and power of some of the individual states within the HRE, such as Prussia, Bavaria, Austria, and others, it becomes clearer, particularly given the propensity of these states to join opposing sides in regional wars or even just fight each other.