Which are correct:
1) It is good taking these medications.
2) It is good, taking these medications.
3) It is good for me taking these medications.
4) It is good for me, taking these medications.
Only (2) and (4) are correct. They use Right Dislocation, which some people find appropriate only in an informal register, as it can sound rather clumsy.
In these sentences, "it" is not an expletive (anticipatory) "it" but a full pronoun. That's why the comma is needed.
As you know, (1) and (2) can be fixed by changing the gerund to an infinitival, so that "it" can function as an expletive:
1a) It is good to take these medications.
3a) It is good for me to take these medications.