I already own Sims 3 and Sims 3 Generations after buying them from Best Buy and Walmart. If I want to buy other expansions through the Steam sales, do I have to rebuy these two in order to play them? Or will they work with the Sims 3 games that I already own?
Not necessarily. If it's eligible for Steam key you can enter the key into steam. Take the product key from both the games you got at best buy, and try to enter them into steam. If its an applicable game..then it'll basically use that key to register the game(s) with Steam and then you will have them unlocked in Steam without having to buy them.
This link explains how to do this: https://support.steampowered.com/kb_article.php?ref=5414-TFBN-1352