If I have an AT&T account already, can I take my sim card out and put it in a used ATT 3g 8gb iphone?

I have a AT&T account with an unlimited data and messaging plan on a Samsung Magnet phone. My friend gave me a AT&T Used 8GB 3G iphone. Can I just put my Magnet sim card in the iphone or do I have to get another type of data plan in order for the iphone to work?

If you don’t get the data plan, AT&T will add it to your account automatically as soon as they detect you’re using an iPhone.