ram1009 :
And last, it's just a bad idea to use old HDDs in new machines. They do wear out and the older they are the more likely to fail. Computers aren't free. Get used to the idea.
It depends on how long they have been used and the age of the drive. If it's under 3 years and doesn't have many hours and you have ran tests on it, i use Spinrite:
https://www.grc.com/spinrite.htm
If the drive is 4+ years old i just wouldn't use it as the main OS drive, nor i would save critical data on it. However since i got plenty of PC's anyway i usually use the older ones for a media device that i regularly backup if i made any changes to it.
It can be a hassle though if you're going through older drives quickly and if the drives themselves are even big enough to store the data you want on them. Pc's are definitely not free but there are work arounds to make them last a bit longer and to get use out of them without spending so much on parts that you may or might not find necessary.
It's really only up to the individual what they really want. I'd rather spend $10 on a couple of old hard drives that might get me through a year or 2 before they die off then spend $150 on a new one that will probably fail within the same timeframe.
Anyway to the OP, i wouldn't use the hard drive on the older system on the new one if it's 3+ years, or without properly testing it first. Generally tho if you had to replace your old system due to aberrant behavior like freezing and if you had viruses chances are your hard drive is compromised. While viruses can't really harm the hardware, the hard drive could still be prone to damage depending on whether the virus causes the hard drive to work harder/excessive use or the hard drive itself could be too hot causing problems. Viruses don't always cause excessive heat to the hard drive, it mainly factors on the way your system is set up and your ambient room temp.
You could use it, reformat it installing a fresh copy of Windows 7 or even Linux if you decide to go that route but too many issues can happen from switching OS's from one system to the next. Just be aware that Windows Vista/7 uses the hard drive in normal operation more often then XP or the older systems did, especially if you use the indexing function (i think a few other Win7 features tend to use the hard drive for whatever reason) so they are not going to last forever. I have a 13 year old system that i have abused but the hard drive still works and been through a couple of hard drives within 5 years. And plenty of drives do fail. Just be aware that a good number of hard drives last 3-5 years before they quit working which is why most of them have dates on when they were manufactured.