It's possible to get Statue of Liberty tickets last-minute, but you really are advised to book in advance to make sure you get the experience you deserve.
Tickets with return ferry journeys and access to Liberty Island are usually easy to come by on the day. If you want to visit the pedestal level, you'll likely need to book in advance of a few days. When it comes to climbing the 354 steps for crown access, you'll need to book up to six months in advance!