It really depends on the magazine and the terms of the contract. Usually they'll buy first-time rights for print or electric or both. So, say, if you sell it to their online magazine and they buy the print rights as well, they get the first chance to put it in print. You could republish it online, but not in print until they do because they own 1st rights.
Some magazines buy rights for a certain amount of time, like a year. And some places buy ALL of your rights. Like I was reading the guidelines for Highlights for Children and they buy all rights including copyright -- they buy it, it's 100% theirs.
So nobody can really tell you what to expect without knowing where you're sending your stuff and what the contract will say. A lot of times the rights that they're buying will be listed in the guidelines so you'll know in advance what you're getting into.