If you have two codes for Battlefield 3, they each do something different.
One code is your online pass, which you need to access multiplayer. The other is typically for joining the Gun Club (or a similar bonus), which isn't as essential but is still worth redeeming for the extra perks. Use the online pass to unlock multiplayer, and redeem the second for whatever bonus content it provides.