Some people have this concept that if a person says God is the one who gives and takes away health, why then does a person go to a doctor rather than going to their mosques or churches when they get ill.
The simple answer is given in the Holy Quran in Surah al-Furqan, Chapter 25, Verse 59 which says
ask thou then about Him of any acquainted (with such things)
Furthermore, we know that the Prophet (S) instructed us to do as much as we can to protect ourselves then leave the rest to Allah. For example, a person cannot leave the doors of his house open and say that he is keeping his trust in Allah. He has to lock all the doors, put as much security as possible and then leave it to Allah.
In the light of the quoted verse, we have to go to the experts of a specific field to ask them about that field. Therefore, we have to go to a doctor when ill. Allah gives life (health) to us through the doctor or the medicines in that case.