The sands o’ life refer to time. The speaker is saying he will still love his girl even after she is old and has lost her beauty.
This is a typical love poem in which the speaker talks about how much he loves his girl. She’s as perfect as a brand new rose. In fact, he compares her to “red, red rose,/That's newly sprung in June.” Now, this is problematic because a rose does not keep its beauty forever. When a rose first blooms, it is perfect. It is a bounty of nature, like a beautiful woman in her prime. However, no one can stay this way—not the rose, and not the lady. Burns acknowledges that.
Till a' the seas gang dry, my dear,
And the rocks melt wi' the sun;
And I will luve thee still, my dear,
While the sands o' life shall run.
The sands of life, basically, are time. Like an hourglass, time will eat away at life’s perfection. Basically, the perfect beauty will become wrinkles and age. No girl can be young forever. Yet, the good news, at least, seems to be that he says he will continue to love her. He says he is aware that her beauty will fade. Time will take its toll on that beuty, but it will not take its toll on his love.
In a way, he is using her beauty to his advantage. He is saying to her that he knows she is beautiful, but she will not have it forever. Other guys might want her now for that, but he will love her forever even after she loses it, therefore she should choose him, because he won’t care when she gets old and fat and has wrinkles.
The speaker, however, does not really have any substance. He is basically just after one thing. If she is naïve enough to fall for this guy, she is going to get her heart broken. He is clearly a blowhard and a buffoon. But hey, maybe she goes in for that kind of thing.
I think it's interesting to see Burns place this line in the same stanza as "Till a’ the seas gang dry" and "the rocks melt wi' the sun." Burns uses these two hyperboles (exaggerations) to signify that he will love the girl for a very long time, but "a very long time" is a very subjective and vague phrase. To some, a very long time may be ten years, but to others, it may be fifty years. Then as if Burns were clarifying this statement with a specific amount of time, he says that he will love her "while the the sands o' life shall run," meaning he will love her until the day he dies. This is a much clearer indication of time, and in my opinion, juxtaposing it to the hyperboles helps make his statement much more indicative of his supposed sincerity.