The 'longing' is a sickness which comes upon the Ogier if they spent too long outside of their steddings. It first developed during the Breaking when the Ogier wandered the world looking for the stedding. The cause of the longing is not mentioned in the books, however I propose that the longing is a result of the taint on Saidin.
Evidence
Chronologically the taint is a viable theory. The Dark One's taint on Saidin sent the Hundred Companions mad and began the Breaking. During the Breaking the Ogier wandered lost and many died of the longing. Ever since the Ogier have been affected by the longing.
In the Age of Legends it is clear that the Ogier did not have the longing. They could leave the stedding for as long as they wished, or live their whole lives in the world outside the stedding. However now they cannot go outside for long and must remain in their stedding. What do the steddings protect them from? The main thing we are told that is different about the steddings is that the One Power cannot be channelled inside them. It is as if the One Power does not exist inside the stedding. What has changed about the One Power between the Third Age and the Age of Legends? It is now tainted. In some way the Ogier must be getting affected by the taint while they are outside the stedding and this is the longing.
The stedding seem to have the same effect on the longing as they do the taint also. If a male channeller who is being affected by the taint enters a stedding, the stedding do not heal him from the taint, they merely prevent him becoming more affected by it as they block him from the source. In a similar way we are Ogier who are affected by the longing tend to stay disabled when they return to the stedding. We are told that Dalar - an Ogier who spent ten years amoungst the Sea Folk - was disabled for the rest of her life because of the affect of the longing. The stedding do not heal the effects of the taint or the longing, they only stop the sufferer from degenerating further.
It is worth noting however that the taint's effect on male channellers is in their mind, causing madness, whereas the effects of the longing on Ogier seem to be purely physical. Although the taint also causes the rotting of the male channellers body, this is still different to the debilitating effect on the Ogier. These differences can be put down however to the difference in species, and the different ways in which the taint is being touched.
Clearly the Ogier do not channel tainted Saidin like the male channellers, so why is the taint affecting them? I would suggest that the true source is part of the world, it flows through and around the world. Therefore the Ogier being more sensitive to the world around them than humans can sense the taint after a fashioned and it has an effect on them as the longing. Thus in their steddings they are protected as the One Power is not present in the steddings and they are protected from the taint.
Summary
I believe that the taint on Saidin is causing the longing. And that if Saidin is cleansed of the taint then the longing will be gone.