It depends on the hardware requirements of later operating systems and also whether the computer/laptop manufacturer supports and supplies drivers for the later operating systems as to whether it is possible or feasible to upgrade or not.
There is no free upgrade from XP to Vista, 7, 8.1 or 10.
Forget about Vista as the extended support for Vista SP2 ends April, 2017.
Follow these steps before you buy Windows 7; extended support Windows 7 SP1 until January 14, 2020 .
Microsoft no longer sells 7; try amazon.com.
Go to your Computer / Laptop Manufacturer’s website and see if Windows 7 Drivers are available for your Make and Model Computer / Laptop.
If not available, Windows 7 will not work correctly for you.
Run the “Windows 7 Upgrade Advisor”
Check to see if your System Specifications are compatible for Windows 7:
“Windows 7 system requirements”
“Windows 7 Compatibility Centre” for Software and Hardware:
Windows 7 Upgrade paths:
“Installing and reinstalling Windows 7”
Follow these steps before you buy and Upgrade (clean install) to Windows 8.1; extended support ends January 10, 2023 .
Check to see if your Computer/Laptop Manufacturer has Windows 8.1 Drivers available for your Model.
If not available, Windows 8.1 will not install and work correctly for you.
There is a lot of information in this first Microsoft link:
Download and run the Windows 8.1 Upgrade Assistant to see if your machine is Windows 8.1 compatible and read the Update to Windows 8.1: FAQs there
“Update to Windows 8.1: FAQ”
“Windows 8.1 system requirements”
How to buy Windows 10; extended support ends October 14, 2025 :
But first make sure that you have the correct system requirements and that your Computer Manufacturer supplies the correct Drivers for 10.
“Windows 10 System Requirements”
Microsoft is making Windows 10 available as free upgrade for qualified Windows 7, Windows 8.1, and Windows Phone 8.1 devices. It will be available starting July 29, 2015
“Windows 10 FAQs”