It seems the accounts at Jeremiah, Matthew and Genesis are a peculiar patchwork of "prophecy".
One person seems to have an answer for this account, but it looks like he is reading too much into the prophecy...
http://www.biblebb.com/files/MAC/sg2186.htm
Matthew, who alone refers to this event, says that it occurred to fulfill prophecy. It fits his theme of fulfilled prophecy at the birth of Christ to establish that He was the King. Let's examine the circumstances under which this prophecy was uttered:
1. THE SETTING
We've already learned in the first two prophecies that sometimes New Testament writers really surprise us by the way they use the Old Testament. Sometimes we just don't understand that kind of usage and we have to broaden our thinking a little, so I want you to see what happens here. The prophecy about Ramah is recorded in Jeremiah 31:15, and what's interesting about it is that it doesn't appear here to be a prophecy. But it is a prophecy because Matthew said it was, not because it's inherent in this text.
a. Weeping for Rejection
Jeremiah 31:15 says, "Thus saith the LORD, A voice was heard in Ramah, lamentation, and bitter weeping; Rachel, weeping for her children, refused to be comforted for her children, because they were not." The prophesying of Jeremiah was perhaps the most tragic prophesying of all in Israel's history, because he uttered the doom of a dying nation. His prophesying was a swan song, as it were, that was uttered with tears, because he knew that nobody would listen or repent and that the captivity was really inevitable.
Later on, there came One greater than Jeremiah who again uttered the same doom for that nation with tears. One day He sat over Jerusalem and said, "O Jerusalem, Jerusalem, thou that killest the prophets, and stonest them who are sent unto thee, how often would I have gathered thy children together, even as a hen gathereth her chickens under her wings, and ye would not!" (Mt. 23:37). And the Bible tells us that Jesus wept over the city (Lk. 19:41). Likewise, Jeremiah sat in view of a people that were doomed, and wept.
b. Hoping for Redemption
But even in Jeremiah's prophecy there is great hope, believe it or not. In the heart of this book, there are four chapters (Jer. 30-33) that are filled with hope, joy, and comfort. Though Jeremiah was prophesying the doom of the Babylonian captivity, which came not long after and took them all away, he also spoke of great comfort and great hope in chapters 30 to 33. And notice that the statement about the weeping and lamentation concerning the children is located right in the middle of the section filled with hope, comfort, and joy. Why? Because even though there was weeping and lamentation, these chapters looked ahead to the coming Messiah, who would set things right. In fact, the very next verses in Jeremiah 31 hint at Israel's divine restoration: "Thus saith the LORD, Restrain thy voice from weeping, and thine eyes from tears; for thy work shall be rewarded, saith the LORD, and they shall come again from the land of the enemy. And there is hope in thine end, saith the LORD, that thy children shall come again to their own border" (vv. 16-17). In other words, God said to Jeremiah, "It's a sad day and there's doom ahead, so you have a right to weep. But refrain from weeping any longer because I will redeem them back." And He did so, didn't He, seventy years later.
The same parallel is seen in the use of the prophecy by Matthew. There was Rachel weeping for her children because of the tragedy and destruction that had come on the nation, which had rejected its Messiah. But at the same time, there was hope because even then there was a remnant, and one day, according to Romans 11, God would regather that whole nation, and they would finally recognize their Messiah. Zechariah said, "...and they shall look upon Me whom they have pierced, and they shall mourn for Him, as one mourneth for his only son..." (12:10b). There's going to be salvation again in the nation of Israel, as Paul clearly said: "And so all Israel shall be saved..." (Rom. 11:26a). You can see then, that there's a general parallel: Jeremiah spoke about doom, and the people of Israel wept about that doom, but Jeremiah said, "Don't keep weeping because things will turn around and there will be salvation." The same thing was true of Christ: When He came there was weeping because His rejection brought doom. But there was comfort in that He would be the Savior of Israel. That's the parallel. There was weeping when the captivity came and the people were scattered, and there was weeping when the deaths in Bethlehem occurred. Those deaths were a sign of the hateful, vengeful rejection of Herod, as well as the indifferent rejection of the chief priests and the scribes and the people...a sign which showed that there was going to be a price to pay. But on the other hand, they were a sign that just as there should have been hope in the hearts of the mothers of Jeremiah's time, there should have been hope in the hearts of the mothers of Jesus' time, because there was going to be a turnabout. There was still hope in a salvation yet to be fulfilled.
2. THE SPECIFICS
a. Ramah
Ramah was a village five miles north of Jerusalem, and was located right on the borderline between the Northern and the Southern Kingdoms in Israel, as indicated in 1 Kings 15:17. It served as the place where foreign conquerors ordered the defeated Israelites to be assembled for deportation to faraway places. Consequently, because of its location, Ramah became symbolic of the North and the South, as the only place where Israel came together. And it was always associated with weeping, because it was there that the deportations into captivity took place.
b. Rachel
By referring to Rachel, Jeremiah was drawing a picture. Rather than Rachel literally going to Ramah and weeping, she was merely used as a symbol of the mothers of Israel in much the same way that Ramah was a symbol of the deportation of the sons and daughters of Israel. The mothers of Israel were crying because they saw their children taken away. That's the idea. Furthermore, it is most interesting that Rachel was Jacob's most cherished wife, who had given birth to Joseph, the father of Ephraim and Manasseh. Those two tribes came to represent the Northern Kingdom, which, incidentally, was often called Ephraim. But later on, Rachel also bore Benjamin, who became identified with the Southern Kingdom. In this light, Jeremiah figuratively saw Rachel as alive, standing at Ramah, and weeping as the Northern Kingdom was deported by Assyria and the Southern Kingdom was deported by Babylon into captivity. Because both of those tribes came from the loins of Rachel, Rachel is depicted as weeping as she sees both sides of her family taken into captivity. She mourned so bitterly, being first deprived of Ephraim (Israel) and then of Benjamin (Judah), because it was she who cried in desperation, "...Give me children, or else I die" (Gen. 30:1b). And now, in Jeremiah's prophecy, she stands as if she were in the middle of those two nations and sees them both taken into different captivities. Israel was weeping because of the captivity of its children. When the population of the land was carried away it seemed as if God had deserted His people. But no sooner had Jeremiah presented the picture of Rachel weeping, than he added, "Stop your weeping, because there is coming a restoration. They will come back." And then over in chapter 33 he spoke about the righteous Branch, the Lord Jesus Christ, who will be the agent to bring them back. In the end the sorrow will be turned to joy in the salvation of the remnant.
3. THE SIGNIFICANCE
Matthew shows us that the Holy Spirit also intended this imagery to reveal the time of the birth of Christ. As Matthew records the slaughter of Bethlehem's babies, it's as if he sees Rachel beginning to weep all over again for her children as the mother of Israel. Some see this prophetically fulfilled in...
1. AN HISTORICAL SENSE
Rachel is identified with Bethlehem by some, because her tomb is near the town. And some Bible commentators also tell us that the word Ramah means "height," so that any place in Israel that was a height could be identified as Ramah. And because Bethlehem is a height, some believe that in those days, it was referred to as Ramah. But I believe that the figure of Rachel at Ramah best pictures what would happen again when the Messiah came.
2. A SPIRITUAL SENSE
Rachel wept again, but this time not because the foreign powers of Babylon or Assyria had destroyed her people, but because Herod had, the king of Israel himself.