Stretches before, during, and after hiking are very beneficial.
Without properly stretching before hiking you can injure
yourself. Stretching our legs before hiking keeps them
limber and injury free. There are many good ways to stretch,
yoga in particular has been recommended by many hikers.
However, certain stretches should be avoided due to their
ability to degrade certain muscles that are used in hiking.
For instance, the lotus position stretches out the muscles
in the knees, weakening them. The calf, ankle, foot, and
toes. Regular stretching during hikes helps prevent injury
during the hike. Water also helps keep the muscles limber,
so bring plenty of water.
Calf Stretch 
Lean against a tall vertical solid object(such as tree
trunk) and place your feet approximately a yard from the
object. Place one leg in front of the other and use the
front leg to lock out the back knee. This will help the
leg relax, making a good stretch possible. Keep your feet
flat on the ground and lean in towards the tree trunk(or
other object) while bending only one knee. This will stretch
the calf and ankle. You should be able to feel the stretch,
if it begins to burn, desist immediately. When you feel
a proper stretch has been attained, switch legs. After
properly stretching both legs, dangle them alternatively
to let the blood flow into your newly stretched muscles.
You should dangle each leg approximately 15 seconds.
Toe and Ankle Stretch
From the same position as the calf stretch mentioned
above, allow the back foot to roll forward onto the toes.
This will stretch out the toes on the back foot. Perform
this procedure for both feet. A simple ankle stretch that
is easily performable in almost any situation is to raise
the foot and rotate it in a circular motion. You can also
move the foot in many different ways to get different
types of stretches(such as raising and lowering the toes).