After reading Anwar's answer I did some more research and can confirm parts of his answer and since @Congusbongus said Anwar's answer seems entirely speculative I would like to add to it.
Why do the South Koreans stand the way they do?
The ROK soldiers stand in a Taekwondo fighting stance to react to anything that may happen. In fact all ROK soldiers are hand selected, have to meet a height requirement and hold black belts or higher in Taekwondo and other martial arts.
They wear sunglasses to show no emotion to the North Koreans.
They hug the wall to keep an eye on North Korea but at the same time able to reach for cover if they are to be shot at.
Why do the North Koreans stand the way they do?
I wasn't able to find any concrete evidence to back up Anwar's answer however it seems logical.
How long does each soldier stand guard like that? I'm sure they take shifts but I can't help but wonder what each soldier is thinking when it is his shift... "OMG, this is boring."
From what I've read and the pictures I've seen, it appears that the ROK soldiers stand guard more often then the NK soldiers. The NK soldiers usually only appear when there is a big crowd of tourists to take pictures of them and catalog them. (I guess NK is worried about "spies") Like Anwar said, the ROK soldiers are there to keep an eye out for any activity in NK but also keep any visitors safe so as long as there is some sort of activity the ROK soldiers are there.
You can check out this Youtube Video. At around 5 minutes you can hear a US soldier describe the information I said above which should be credible!