Ralph stands at one of "the crossroads of life"...his tears are the culmination of his life experiences on that island. He weeps because he has reached a higher level of being. As Ralph reaches the pinnacle of fear, he also experiences an awakening. Ralph embraces who he was and what he did... he sees the parallels he has with Jack, however is able to escape at the "last moment" of reality that had connected them. The reason Ralph weeps at the end of the novel is to suggest that when a human being finds themself at a crossroad, it is that moment that separates the individual from all of the other moments of their life. He is rescued and in essence is cleansed from his time on the island. Ralph faces "the beast" without glitz or glamour, it is his consistency of person that ultimately brings him the gift of rescue. He survives because he is steadfast. His humanity conquered his hopelessness, thus he is the moral of the story.
Ralph weeps for the innocence lost from the boys on the island, the deaths of Simon and Piggy, his own death which he didn't see a way to avoid, and also for the friendship of SamnEric, the twins, who make a conscious decision not to blow the whistle on Ralph's position even though they have seen him.
At this point in the novel, everything is coming to a head and Ralph, now isolated, is finding it hard to keep emotions and the realities of it all in check. His tears are an amazing overflow of all he has just experienced, combined with the relief of his own miraculous rescue by the naval officers who have come as an answer to the fires on the island --set not to call for help for once but to smoke the "pig" out of his hiding spot.
Ralph weeps for the end of innocence. He cries when he runs onto the beach and into the arms of a naval officer escaping his death from all who have turned against him. He weeps for the deaths of Simon and his confidante, Piggy. Ironically, the naval officer discovered them by the smoke from the fire commanded by Jack to smoke Ralph out of his hiding spot discovered by the betrayal of Samneric. This was another cause of Ralph's weeping.