Provided that your Mac model year is supported, you can upgrade.

From 10.6.8 you can upgrade directly to 10.11 (free). Then from 10.11 you can upgrade to 10.12 (free).

To do so, an app called “App Store” is installed with 10.6.8 and later. You use this app to download then install 10.11. After 10.11 is installed and running you use the “App Store” app again to download 10.12 (OS 10.12 requires OS 10.7 or later.)

For list of Mac models supported by the new versions of OS X, do internet searches for “system requirements for OS 10.11” and “system requirements for OS 10.12”.

On other hand, the App Store app should only make OS 10.11 available if your Mac is supported. And then after OS 10.11 is installed will make OS 10.12 available if your Mac is supported.

Once OS 10.12 is installed, you may have to do “Software Update” (under the “Apple Menu”) to bring up to the latest revision (as of March 27 it is OS 10.12.4).