When they had departed, behold, the angel of the Lord appeared to Joseph in a dream and said, "Rise, take the child and his mother, flee to Egypt, and stay there until I tell you. Herod is going to search for the child to destroy him." Joseph rose and took the child and his mother by night and departed for Egypt. He stayed there until the death of Herod, that what the Lord had said through the prophet might be fulfilled, "Out of Egypt I called my son." When Herod realized that he had been deceived by the magi, he became furious. He ordered the massacre of all the boys in Bethlehem and its vicinity two years old and under, in accordance with the time he had ascertained from the magi. Then was fulfilled what had been said through Jeremiah the prophet: "A voice was heard in Ramah, sobbing and loud lamentation; Rachel weeping for her children, and she would not be consoled, since they were no more." (Mt 2;13-18 )
A new born baby poses a threat to the most power man in the country. The powerful man makes use of his power to destroy the future of the society. Massacre is not in numbers (it also) babies killed rather the whole future, a generation is destroyed. A paranoid man will do the same. He will not accept the reality and he also will not face the challenge posed by the situation rather he will destroy the future.
Matthew quotes the Old Testament in three places in this passage. He quotes Jeremiah 31:15 ("A voice was heard in Ramah, sobbing and loud lamentation; Rachel weeping for her children, and she would not be consoled, since they were no more." ) This is all about God’s renewal of the covenant. It is about bringing Israel back from exile at last. Though Israel must weep and mourn, rescue is on the way. This is about Jesus bringing deliverance.
His coming out of Egypt is also given as a model and based on a model of Exodus. He himself experiences deliverance and he actuates deliverance. One should experience what he wants to give to the other.