In principle, your two years in Poland should count towards EU long-term residence but the German implementation of these rules seems very messy. That would not be exactly equivalent to a German Niederlassungserlaubnis and doesn't necessarily help you very much in this case.
Specifically, article 16 of Directive 2009/50/EC provides that:
- By way of derogation from Article 4(1) of Directive 2003/109/EC, the EU Blue Card holder having made use of the possibility provided for in Article 18 of this Directive is allowed to cumulate periods of residence in different Member States in order to fulfil the requirement concerning the duration of residence, if the following conditions are met:
(a) five years of legal and continuous residence within the territory of the Community as an EU Blue Card holder; and
(b) legal and continuous residence for two years immediately prior to the submission of the relevant application as an EU Blue Card holder within the territory of the Member State where the application for the long-term resident's EC residence permit is lodged.
In other words, you should be considered an EU long-term resident (under directive 2009/50/EC) after three years in Germany instead of five (that's five years in the EU in total, of which the last two must have been spent in the member state where you apply, in this case Germany). Unfortunately, there is no sign of these rules in the relevant German law so in practice it might be difficult to convince German bureaucrats to follow the law.
From an EU law standpoint, the EU long-term residence status is not necessarily equivalent to a national permanent residence status like the German Niederlassungserlaubnis, which is controlled by other rules. German law does however seem to consider that, unless explicitly stated otherwise, anyone who qualifies for the EU long-term residence status should also be treated as if they have a Niederlassungserlaubnis, as specified in § 9a of the Aufenthaltsgesetz
Soweit dieses Gesetz nichts anderes regelt, ist die Erlaubnis zum Daueraufenthalt – EU der Niederlassungserlaubnis gleichgestellt.
Of course, the delay before applying for a Niederlassungserlaubnis is shorter for EU Blue Card holders, which makes the rules around EU long-term residence moot for your purposes. According to § 18c of the Aufenthaltsgesetz, you need to have worked in Germany for 33 months if you only have basic German-language knowledge and for 21 months if you have “sufficient” German-language knowledge.
21 months is shorter than the shortest potential duration of residence before applying to be recognized as an EU long-term resident (namely 24 months), which is why even if the years spent in Poland ought to be taken into account for something, it still wouldn't help you gain any sort of long-term or permanent residence status in Germany any quicker. Theoretically, all this could make a small difference for someone who doesn't speak German well and has spent about three years in Poland (because 24 months is shorter than 33 months) but not to someone who has a good command of German or only held a Blue Card for two years.
Of course, in countries that do not offer as quick a path to permanent residence to Blue Card holders as Germany, the fact that you do not have to start from scratch can make a bigger difference (e.g. in France it could mean two years instead of five).