Yes, no matter when you hike, you need permits for the Inca Trail. (the trail is closed every February for maintenance) I suppose you could be asking if it's possible to show up in Cusco and find places on the Inca Trail last minute? It is feasible at certain times of year, but not probable. Usually the permits sell out in advance. You cannot buy the permits yourself. You have to "buy a hike" from an operator who gets the permits for you. You must provide valid passport to get a permit. You have to show that passport at the checkpoint to enter the trail.
Permits are needed for the strenuous 4 day hike and for the easy 1-day hike. Permits cannot be transferred, cancelled, refunded or changed. If you don't show up, your place will go empty. There are 500 places allowed on the trail each day, including porters and guides. You will find cheap hikes in groups, private hikes, and "superior" comfort hikes. The quality of the hiking experience varies. Make sure you understand what kind of hike you prefer. It's an amazing hike. I hope you get to do it. about 5 years ago
I found that chances of getting on one of the less well known routes without booking in advance were pretty good, but if you want to do the actual inca trail, the permits can be booked out a couple of months in advance. I would recommend booking it at the same time you buy your airline tickets. about 5 years ago