I have an old 29er that came with a 7 speed shimano tourney groupset, can I replace that with a 9-10 speed new set, just by getting new hubs? or the wheel cant handle that setup? the frame needs to be "prepared" for that change too?
You may be able to get a 9 or 10 speed sprocket cassette on your wheel, if you have a freehub style hub rather than an older style freewheel. Its a common misconception that cassettes with more sprockets are wider, so the hub needs to be narrower or the frame needs to be wider, but actually the sprockets are closer together. 8, 9, 10 and mountain bike 11 speed cassettes are all the same width.
This does not mean you can convert your bike to 9 or 10 speed though. TL:DR - it's usually not cost effective to upgrade Tourney level bikes.
You would need to replace the cassette, rear derailleur, chain and shifters, very likely the crankset, front derailleur and bottom bracket too. For 10 speed you would need to be at Shimano Deore. If you add in the special tools required, paying someone to install it all (or making the investment in learning how to do it yourself), you will find that the cost approaches that of a new bike.
Depends on what type is your rear hub. If it's for threaded freewheel then no, you can't - you must change the hub before putting 9/10sp splined cassette
Here is an example of mass hub types - Bicycle Rear Hub
Yes, you can. You simply need to rebuild the whole wheel, as mentioned in the comments. You might be able to reuse the spokes, maybe you will have to buy the new ones. This leaves you with the old rim only.
It's like asking "can I replace a complete drivetrain in my 4WD car for something better?" Yes, you can however oftentimes it is much easier, faster and financially more convenient to simply get a new car.
Now some serious information - measure the width of your 7 speed and compare it with the 9 or 10 speed cassette you are planning to put on. It may happen that the widths are not that different and you can still fit the new cassette on the existing hub. It goes down to the spacers between the cogwheels. See my explanation here: https://bicycles.stackexchange.com/a/55668/34697
Furthermore, similar question was already asked:
Could I replace a hub on a wheel?