With AT&T (or TMobile), yes. A GSM phone only needs to have radios compatible with the carrier. If it's an AT&T S4, it'll work. (If it's a TMobile S4, or an international S4, it may and it may not - but it won't hurt anything if you swap the SIM and try it - and it doesn't work. Just put the SIM back into the S7.)
(If it was a CDMA phone - Verizon or Sprint - it's not that simple - the phone's electronic serial number has to be in the carrier's database - and they won't add your phone.)