One morning during my prayer time, a certain person, who I prayed for often, kept coming to my mind. It was a very persistent urging to pray for him, which I did. An hour later he was dead. Why do you think the Lord urged me to pray for someone who He knew was about to die?
I normally don’t answer questions like this because I don’t like to offer unsupported opinions and any chapter and verse I might point you toward would be stretching things. You could ask the Lord why He did this but it doesn’t really matter. What matters is that you sensed the Lord leading you to pray for someone and you responded by doing so. The rest was between Him and the person you prayed for. Perhaps you’ll get the rest of the story when you get to heaven.