"And the LORD said unto Moses, etc." From here you learn one of the thirteen measures by which the Torah is expounded, the rule of kal va-chomer (the inference from minor to major). How so? "If her father had but spit in her face, should she not be ashamed seven days?" — a kal va-chomer: as for the Shechinah, fourteen days. But it is sufficient for that which comes from the inference to be like that from which it is inferred. "Let her be shut up seven days, etc., and afterward she shall be brought in again." Why? Because Aaron was not able to shut her up, as it is said, "and the priest shall shut him up" (Leviticus 13:4). Rather, the Holy One, blessed be He, shut her up.
Why Miriam Was Shut Out Seven Days and the Rule of Dayyo
Midrash Aggadah, Numbers 12:14
ויאמר ה' אל משה וגו'. מכאן אתה למד אחת משלש עשרה מדות שהתורה נדרשת בהם, מדין קל וחומר כיצד, הלא תכלם שבעת ימים קל וחומר לשכינה ארבע עשר יום, אלא דיו לבא מן הדין להיות כנדון: תסגר שבעת ימים וגו' ואחר תאסף. למה לפי שאהרן לא היה יכול להסגירה, כמו שנאמר והסגיר הכהן (ויקרא יג ד). אלא הקב"ה הסגירה: