1. Stick to the trails.
One of the best things that you can do to prevent getting lost in the first place is to stick to the trails. You may accidentally end up off-trail. However, if you go hiking in an area that has a pretty well-established trail system, you should be able to find the trail within a reasonable amount of time. You can still get lost on a trail system. Nevertheless, you will be much less lost than if you go out on your own away from the trails. Trails tend to be well-marked with signage indicating which way to get to a particular location. Therefore, even if you do get lost, you should find a sign that will help you out within an hour or less.
If you decide to take an off-trail hike, make sure that you go with a well-experienced person. Stick to open country rather than wooded areas. Furthermore, aim for a location that has good visibility. That way, you can see where trails and roads are. Be extra prepared with a compass, first-aid kit, extra clothes, extra food, and anything else you may need should things go south. Preventing yourself from getting lost in the first place is worth more than all of the survival skills in the world. Make sure that you take the necessary precautions to be safe and know where you are.