It depends on the version of Windows and how much the components have changed. If the CPU is Kaby Lake or newer or Ryzen/Threadripper. It needs to be Windows 10.
As for using a previous Windows install on a new PC. The only time I'd do it is if the motherboard was replaced with the same make and model. You're probably safe with a similar spec board of the same generation.
The further apart the motherboards are. The more problems you'll likely have. Odds are it will boot if you switch motherboards. In my experience your system will be plagued by instability issues. You'll spend more time trying to hunt down and fix problems than you would have just performing a clean install. I mean booting off an install disc or USB, wiping out all...