This is for websites that operate out of a German speaking country (Germany, Austria, Switzerland) or jurisdiction - even if the website is not '.de' - OR foreign companies that direct business to Germany, or gain German customers or clients.
For example - a site from Nigeria that sold things to or had business activity with German clients would need an impressum - but not if it were a Nigerian travel blog that did not sell or had business interactions with a German jurisdiction - for example. If you do need an impressum you ALSO need an impressum on your Social Media presences (Facebook etc)
Generally, the country-of-origin-principle according to § 3 Abs. 1 TMG
applies, meaning that foreign organisations are not subject to the
imprint requirement. However, many organisations do not know that a
business location in Germany (a desk in a co-working space is already
sufficient) leads to an imprint obligation. The same applies if the
foreign organisation directly addresses the German market with its
website, i.e. actively is acquiring customers in Germany. In this
case, the organisation concerned must make an imprint available,
because the German consumers have – according to a judgement of the
regional court Frankfurt a.M. (Judgement of 28.03.2003, Az. 3-12 O
151/02) – an interest to know which law the foreign organisation is
subject to, who exactly is the contact person and which agency
relationships exist. - see here
Other sources:
https://www.rockit-internet.de/en/what-is-an-impressum/
https://www.ionos.co.uk/digitalguide/websites/digital-law/a-case-for-thinking-global-germanys-impressum-laws/