To switch rear wheels, you not only need the same rim size, but the same hub width. If all parts are from the last 10-15 years you are probably OK, but be aware that rear dropout spacing went from 120 mm (5 speed freewheels) to 126 mm (6 and 7 speed freewheels) to 130 mm (8, 9, 10 speed road cassettes) or 135 mm (7- 8- and 9-speed MTB). It's best to keep together a chain and gear cluster that are worn together, but these days chains seem to wear quickly, and you can often replace a chain without replacing the gear cluster. You can always try it and see. If the chain skips or the system makes excess noise, then you need to replace both together.