You don’t need a German phone number to call German mobile or landline numbers cheaply. You just need a provider which has decent rates for calling German numbers.
Nowadays, many landline or mobile providers include calls to landlines in a lot of countries and mobiles in a few. I know I can use my mobile phone and call landlines in dozens of countries for free for instance.
Some providers will ask for some kind of extra subscription to add this to your plan if it’s not included.
If this is not available on your existing network/plan or in your country (or it’s too expensive), nearly any VOIP service provider will do. Rates vary a lot, between prepaid/pay as you go and subscription services at various monthly rates, so you may have to shop around, but even Skype has calls to German landlines at 2.1p/minute and to German mobiles at 9.3p/minute for the most basic pay as you go plan, and it can be cheaper with subscriptions.
Google voice has rates between 1 cent/minute for landlines and 25 cents/minute for the most expensive mobiles, with most others at less than 4 cents/minute.
Remember that many tools/apps you can use to call other users of the same app for free allow you to purchase credits or subscriptions to also call regular phone numbers.
Some subscriptions can also get you a German phone number (which is useful if you need to give a number people can call you on). Again, large number of providers for this, so you’ll have to shop around, but remember you don’t actually need a German phone number, you just need a provider which allows you to call German numbers cheaply.
Also note that some countries have restrictions in place which will allow VoIP providers to give you a number from that country only with a proof of address in that country. Not sure if that applies for Germany though.