Melchizedek has explained to Santiago about humans' personal legends with which each person is born, explaining that as children we, according to Melchizedek, intuitively know though we lose sight of it as we grow older. The story about the miner and the emerald is meant by Coelho to illustrate Malchezidek's legend about the Personal Legend. Thus is connects to Santiago by being a means of encouraging and motivating him through offering him deeper insight and understanding.
Santiago's "situation" is that he is on a journey to find a treasure. His personal legend. He has had some success and he has had some setbacks. All of that is to be expected, and the old man tells Santiago a story about a miner that is meant to encourage Santiago to not give up.
The story tells about a miner who has been looking for a beautiful emerald for the last five years. He has had no luck, and he is ready to give up. Out of anger and frustration, the miner throws a rock against another rock. The second rock is split open from the impact, and a gorgeous emerald is revealed.
But he had thrown it with such force that it broke the stone it fell upon, and there, embedded in the broken stone, was the most beautiful emerald in the world.
The story is meant to show the duality of nature and life. Things are neither good nor bad. They simply are. The very same rocks that the miner is ready to give up on are the very same rocks that are loaded with treasure.
The point of the story is to emphasize to Santiago the importance of staying vigilant and watching out for the omens that will lead him to his treasure. The story is meant to remind Santiago that even the bad things that happen might be helping him to find his treasure.
"In order to find the treasure, you will have to follow the omens. God has prepared a path for everyone to follow. You just have to read the omens that he left for you."