Check if your Mac is compatible with either Mountain Lion or Lion;
Lion 10.7:
Mac computer with an Intel Core 2 Duo, Core i3, Core i5, Core i7 or Xeon processer
2GB RAM (4GB minimum recommended)
OS 10.6.6 or later (10.6.8 recommended)
7GB of available HD space
Mountain Lion;
Your Mac must be one of the following models:
iMac (Mid 2007 or newer)
MacBook (Late 2008 Aluminium, or Early 2009 or newer)
MacBook Pro (Mid/Late 2007 or newer)
MacBook Air (Late 2008 or newer)
Mac mini (Early 2009 or newer)
Mac Pro (Early 2008 or newer)
Xserve (Early 2009)
And meet the same RAM and disc space requirements as Lion.
For Mountain Lion, go to the App store and purchase and download.
For Lion,
You can get it only by phone now from Apple.
In the US, call 1-800-MY-APPLE and ask for a sales assistant.
They'll give you a download code to use in the Mac App Store.
Warning - you may need to spend a lot of money on updates or replacements for software which work ok on Snow Leopard. PPC Apps such as Appleworks, MS Office 2004 and a lot of Adobe stuff for instance.
In either of these OSs, you need to go to Oracle's website to download Java 7.