The speaker says this because he's very much in love with his lady, a "bonnie lass." In fact, he's so much in love that he promises to love her even when the seas go dry. Perhaps, through his proclamation, he hopes to make clear to his beloved the depths of his emotion for her.
The whole poem speaks about the narrator's obsession and preoccupation with his lady. To him, she's as beautiful as a red rose in June, and she's like "the melody / That's sweetly played in tune." He promises to love her until the end of time, even when the "rocks melt wi’ the sun and "the sands o’ life shall run." Towards the end of the poem, we discover that the narrator is going away. He bids farewell to his lady love and promises that he will return once more to her, even if ten thousand miles separate them. So, before he goes away on his journey, the narrator basically wants his lady to know how deeply he loves her.
As to whether his words are written to assure his lady or to cement a romantic promise made between both of them, the narrator does not say.