I've just purchased a laptop with Windows 10 pre-installed. However, I don't want to use it right now and I want to replace it with Ubuntu. My question is, if in the future I want Windows 10 back, how do I restore it?
It depends. Some systems will have a partition for a system restore and some will have you create media to restore it. If it does have a partition and you wipe it out, you may find yourself paying for recovery media from the manufacturer.
A couple of different options
Install a hyper visor and install Ubuntu as a VM
Clone the entire disk and use that a backup media
Install the WSL and Ubuntu via the Windows store and you can run most Linux binaries with GUI supporting coming as well
I've created a backup of Windows using Macrium Reflect. But I don't know if that can be used to install Windows on an Ubuntu laptop. I assumed that you can only restore that if you have Windows installed.