Specifically, does it matter if medication comes in gelatin capsules? Is there a difference what the medication is?
It does depend on whether a person is seriously ill, in which he can take any medication, or just suffering from a mild headache, in which case he should avoid non-kosher medication. See Dose of Halacha:
While gelatine, unless certified as kosher, comes from non-kosher animals (or animals not shechted) there is a machlokes as to whether it is kosher or not.
R’ Chaim Ozer Grodzinski (Achiezer 2:11; 3:33:5), R’ Yechezkel Abramsky (brought in intro to Tzitz Eliezer 4), R’ Eliezer Waldenberg (Tzitz Eliezer 6:16; 10:25:20:2) and R’ Ovadia Yosef (Yabia Omer 8:YD 11) all write that one may eat gelatine even from a non-kosher source (See Shearim Metzuyanim Behalacha 47:5).
However, R’ Aharon Kotler (Mishnas R’ Aharon 1:16), the Chazon Ish (YD 12:7), R’ Yitzchak Yaakov Weiss (Minchas Yitzchak 1:52; 3:147; 5:5), and R’ Moshe Sternbuch (Teshuvos Vehanhagos 2:381) all write that one can only eat gelatine from a kosher source.
R’ Moshe Feinstein (Igros Moshe YD 1:37, 2:23, 2:27, 2:32) writes that because of the doubt, one should not be lenient and eat only kosher sourced gelatine (See Har Zvi YD 83).
R’ Shmuel Wosner (Shevet Halevi 7:135) writes that one may be lenient, however, for a choleh she'ain bo sakanah (one confined to bed as a result of their illness - See Shulchan Aruch and Rema OC 328:17). R’ Shlomo Zalman Auerbach (Minchas Shlomo 1:17; Shemiras Shabbos Kehilchasa 40:n169) writes that swallowing medicine pills is not considered eating. Thus, one with a serious condition such as asthma may take such medication. One suffering from a headache, etc. (mechush) should make the effort to find an alternative that doesn’t contain any non-kosher ingredients (Rema YD 155:3).