I don't think there is any reason to believe that getting medical care as a foreigner in Germany would be difficult. Expensive, perhaps, difficult, no. Foreigners in Germany surely get sick all the time, and I would not expect preventive care that is the standard care in Germany to be different even if it isn't available where you come from. I recommend doing a web search for clinics in Germany (preferably in the area where you will be) and trying to get some real information. They will probably be happy to talk with you and tell you what is and is not possible. They might even be willing to tell you what it will cost (which, believe me, would be nearly impossible to find out if it were the US!). Or if you know anyone living in Germany, you could ask them.
I did a little web searching and found this site to give a lot of info that looks useful:
[think before following links] https://wise.com/us/blog/healthcare-system-in-germany