Upgrading to VMM 2012 SP1 or to VMM 2012 R2
If you are running VMM 2012, you can upgrade to VMM 2012 SP1. As VMM 2012 SP1 requires Windows Server 2012, you will need to upgrade the OS beforehand.
If you are running VMM 2012 SP1, you can upgrade to VMM 2012 R2. As VMM 2012 R2 requires a minimum Windows Server 2012, you don't need to upgrade the OS beforehand, although I recommend that you upgrade the OS to Windows Server 2012 R2.
Make sure you take a backup of the VMM database. See step 2 in the next section, Upgrading VMM 2012 R2 to VMM 2016, that provides backup guidance as well.
Next, I would recommend that you uninstall VMM 2012, retaining the database, followed by the installation of the VMM 2012 SP1/R2 prerequisites:

Proceed with the VMM 2012 SP1/R2 installation using the same database. For more details on installing or upgrading VMM 2012 SP1/R2, see the step-by-step guide available at https://rlevchenko.com/2013/04/14/upgrading-vmm-2012-on-server-2008-r2-to-vmm-sp1/ or refer to steps 6-20 in the section Upgrading VMM 2012 R2 to VMM 2016.