If you're traveling just to hike, I'm guessing you already have some trail experience under your belt. (If not, no worries! I've got plenty of information about essential gear and how to get started hiking.)
As long as you're well-informed about what to expect on the trail and know what you need to deal with it, packing for the actual hiking part of your trip is relatively straightforward. But what about getting though airport security, and what about those rare non-trail days when you're expected to be relatively presentable?
Using Your Backpack as a Carry-On
Your backpack is the logical choice for carry-on luggage, as long as it falls within the maximum dimensions allowed by your airline of choice. If your pack is larger than said dimensions, it'll have to go as checked baggage. Buckle and cinch down all the straps that you can, add a luggage tag, then put the whole thing in a large, clear garbage bag to protect it (some airlines will provide these during check-in, but bring your own just to be safe).
If you're forced to check your larger pack, you can always use a large stuff sack as an improvised carry-on -- that way you're not stuck with an extra piece of luggage to manage once you hit your destination. Some large backpacks also come with an integrated day pack or hip pack you can detach and use as a carry-on. And the hiking shoe is a must thing as like as your backpack.
When it comes to actually packing your backpack as a carry-on, it's really no different than packing for a hike -- except that a few of the items you're probably used to having along, like trekking poles and a pocketknife, aren't allowed in carry-on luggage.
Do I Have to Check This?
Check out this list of hiking items you can and can't take on an airplane with you.* Just about anything goes if you're traveling by car. If you're traveling by train, consult the rail line's website for details about what is and isn't allowed aboard.
Sort anything that has to be checked into its own pile -- you're either going to have to do without these items, buy replacements at your destination, or check them through in an extra bag or box. Boxes padded with bubble wrap or newspaper offer the best non-suitcase protection, but if the items you're packing aren't too fragile you can use a stuff sack as an improvised suitcase. (The stuff sack should close securely, and you need to label it clearly -- in a pinch, write on a piece of duct tape with permanent marker to create a label.)
The Mighty Packing List
Start with your usual packing list for whatever sort of hiking you're doing (if you don't have a "usual" packing list, now's the time to make one). It is a nice practice to pick best hiking GPS in your list. Forgetting a critical item is bad enough when you're only a few miles from home; it can ruin your whole trip when you're hundreds or thousands of miles away from a replacement, or at the very least bust your budget.
Pack at least one change of clothing that's not make of nylon -- that way you won't announce your presence with the annoying "shh, shh" of nylon-on-nylon on the rare occasion you want to blend in with polite society. These can double as your travel clothes, so you'll always be fresh coming and (assuming at least one laundry stop) going.
Research local customs while you're at it. If any particular words or gestures are considered rude (or particularly polite!) where you're going, it would behoove you to know in advance. You stand a much better chance of coming across politely if you research local customs about clothing and hospitality, too (assuming you're traveling internationally).
An Informed Hiker is a Safe Hiker
Research your target trail, and local conditions, thoroughly. Get a feel for the current and expected weather conditions, then pack accordingly. Keep in mind that changes in elevation can lead to radical changes in climate.
If you don't really have your layering system dialed in just yet, I advise including an extra, lightweight layer for the sake of comfort. If the weather turns foul while you're on the trail, blaming the weatherman won't do much to keep you warm and dry -- but that extra layer will.
You should always check the latest TSA regulations for confirmation, using their lists of prohibited/allowed items or their mobile "What Can I Bring?" tool, which you can also access from a regular computer.