1st, 2nd and 3rd gen Glock mags work with 1st, 2nd and 3rd gen Glocks in any combination with no problem. (Gen 1 mag with gen 3 Glock or Gen 3 mag with Gen 1 Glock - all good.)
Gen 4 mags with the ambi cutout and new follower work with Gen 1, 2, 3, and 4 Glocks.
Gen 4 Glocks, (as in those with the ambi release G21SF style), only work with gen 4 mags. Gen 1, 2 & 3 mags don't have the ambi release cutout so they won't work.