There are a number of laws that explicitly define the prerequists to become a professor in Germany:
On the one hand, there is the "Hochschulrahmengesetz" (which can be roughly translated as "regulatory framework about institutions of higher educations"). This is a federal law. In § 44(3) the following requirement for becoming a professor is listed:
besondere Befähigung zu wissenschaftlicher Arbeit, die in der Regel durch die Qualität einer Promotion nachgewiesen wird [...]
My translation:
Particular qualification for scientific work, evidence of which is usually given by the quality of the PhD.
In addition, each federal state has a law about institutions of higher educations - called "Hochschulgesetz" or a version thereof for most states - where one typically finds similar requirements (examples for Bavaria, see § 57 (3), and North-Rhine Westphalia, see § 36(3)).
To understand how those laws are applied in practice, one needs experience with the common meaning of PhD grades in Germany. If you get a PhD from a German university, you will get one of the grades "summa cum laude", "magna cum laude", "cum laude", and "rite". Those latin expressions are purely traditional. Their literal translations have very little to do with their actual meaning nowadays. Their actual meaning is roughly as follows:
summe cum laude: an exceptionally strong thesis
magna cum laude: this is the standard grade that you'll get when your thesis is of a reasonable quality.
cum laude: the thesis is subpar
rite: this should happen really rarely. If you get this grade, something went really wrong during your PhD
So if you have a PhD from a German university and your grade is not "magna cum laude" or "summa cum laude", this will typically be interpreted in the sense that you do not meet the requirement in law explained above.
Note that arguments of the type "if you did good work during your PhD, then nobody will care about your grade" are a bit strawmanish: if you did good work during your PhD, you will get "magna cum laude" or better, so the issue will not arise.
Summary: Yes, if your grade in a PhD from a German university is lower than "magna cum laude", this will cause severe problems for an academic career in Germany and those problems exist by law.