You can purchase a day pass for $5 or you can purchase a yearly pass for $30. If you think you will be doing 6 or more hikes per year, the yearly pass is definitely worth it. Even if you don't, the money goes towards preserving our trails and it keeps you from having to purchase a pass every time you go on a hike. You can check here to see if your hiking location requires a pass Locations Requiring a Pass.
For example, on our last hike, I had to drive past our destination to go to the ranger station and purchase a pass. I decided to purchase a yearly pass so I didn't have that problem again. Here is what a yearly pass looks like.
Forest Pass Online. Check here for local vendors in your area Forest Pass Vendors. Other places that you can purchase a pass include:
Most sporting goods stores should have these available. Happy Hiking!