It is narrated from Sayyiduna Ibn Abbas (may Allah be pleased with them both) that a man said: "O Messenger of Allah, does medicine benefit at all (against) the divine decree?" He (peace and blessings be upon him) said: "Medicine too is part of the divine decree, and sometimes it gives benefit by the permission of Allah."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 12729