Our teacher, the Beit Yosef, wrote in section 5: "One who marries a widow should not have the first intercourse with her on either Shabbat or Yom Tov." Thus far his words, and this is from the Yerushalmi. And the explanation of the matter: Behold, in Even HaEzer siman 64 it was explained that a virgin has a chuppah but a woman who was previously married does not, see there; and the reason is that he holds that chuppah is the veil, and that which they lead under the chuppah with the celebrations of groom and bride, and this is only for a virgin. According to this, for a widow there is no acquisition of chuppah, and the acquisition is the intercourse, and therefore it is forbidden on Shabbat. And they explained that which is found in the Yerushalmi at the beginning of Ketubot: "Those who marry widows need to marry them while it is still day," meaning to have intercourse with her, for this is because she has no chuppah.
But there are those who disagree and hold that even for a woman who was previously married there is a chuppah, for chuppah is defined as the seclusion fit for intercourse, and this is equal whether for a virgin or for a widow or a divorcee (the Gra, subsection 16, and there in Even HaEzer, see there). And the Yerushalmi that says: "Those who marry widows," its intention is because a virgin is anyway forbidden to have the first intercourse on Shabbat, for such is the system of the Yerushalmi, and the intention of the Yerushalmi is the seclusion fit for intercourse. And even for a virgin it is so for us, for we hold that it is permitted to have the first intercourse with a virgin on Shabbat. And we have already explained this in Even HaEzer there, and there in siman 55 we explained at length what chuppah is, and in section 14 there we explained that the poskim do not disagree at all, see there, and there in siman 64 section 17 we explained that even regarding a widow there is no dispute. And if there was seclusion fit for intercourse while it was still day—he may according to the law have intercourse with her on Shabbat, and even for a virgin there are those who require specifically seclusion fit for intercourse while it is still day (Magen Avraham subsection 11 in the name of Maharil).
However, regarding a widow alone, the Maharil wrote the law that there is danger in the matter to have the first intercourse with her on Shabbat (ibid.), and in Even HaEzer there we brought that there was such an incident and she died immediately, see there, and therefore we are accustomed to warn about this very much. And this is only for a widow and not for a divorcee, for with a divorcee, if there was seclusion fit for intercourse while it was still day—he may have intercourse with her on Shabbat. And the seclusion while it is still day requires that there be no other person in the room (ibid.), and if she was not fit for intercourse while it was still day, such as if she was impure—she is forbidden to immerse on Shabbat, for it is forbidden for him to have intercourse with her on Shabbat, since previously he did not acquire her at all, because there was no seclusion fit for intercourse (ibid., and he disagrees with the Chelkat Mechokek, and also the Beit Shmuel there disagreed with the Chelkat Mechokek, see there).
וכתב רבינו הב"י בסעיף ה': "הכונס את האלמנה לא יבא עליה ביאה ראשונה לא בשבת ולא ביום טוב" עכ"ל, וזהו מירושלמי. וביאור הדברים: דהנה באבן העזר סימן ס"ד נתבאר דלבתולה יש חופה ולא לבעולה ע"ש, והטעם דסבירא ליה דחופה היא ההינומא, ומה שמוליכין תחת החופה במזמוטי חתן וכלה, וזה אינו אלא בבתולה. ולפי זה באלמנה ליכא קנין חופה, והקנין הוי הביאה, ולכן אסור בשבת. ופירשו דמה דאיתא בירושלמי ריש כתובות: "הלין דכנסין ארמלין צריכין לכונסן מבעוד יום", כלומר לבא עליה, דזהו מטעם שאין לה חופה. אבל יש חולקין וסבירא ליה דגם בבעולה יש חופה, דחופה מקרי היחוד הראוי לביאה, וזה שוה בין בבתולה בין באלמנה וגרושה (הגר"א סקט"ז ושם באבן העזר ע"ש). והירושלמי שאומר: "הלין דכנסין ארמלין" כונתו משום דבתולה בלאו הכי אסור לבעול בתחלה בשבת, דכן הוא שיטת הירושלמי, וכונת הירושלמי ליחוד הראוי לביאה. וגם בבתולה כן הוא לדידן, דקיימא לן דמותר לבעול בתולה בתחלה בשבת. וכבר בארנו זה באבן העזר שם ושם בסימן נ"ה הארכנו לבאר מהו חופה, ובסעיף י"ד שם בארנו דהפוסקים לא פליגי כלל ע"ש, ושם בסימן ס"ד סעיף י"ז בארנו דגם באלמנה ליכא מחלוקת. ואם היה יחוד הראוי לביאה מבעוד יום - יוכל מדינא לבועלה בשבת, וגם בבתולה יש מצריכים דוקא יחוד הראוי לביאה מבעוד יום (מג"א סקי"א בשם מ"ב). אך באלמנה לבד הדין כתב המהרי"ל שיש סכנה בדבר לבא עליה ביאה ראשונה בשבת (שם), ובאבן העזר שם הבאנו שהיתה מעשה כזה ותיכף מתה ע"ש, ולכן אנו רגילין להזהיר על זה מאד. וזהו רק באלמנה ולא בגרושה, דבגרושה אם היה יחוד הראוי לביאה מבעוד יום - יכול לבא עליה בשבת. והיחוד שמבעוד יום צריך שלא יהא שם שום אדם בהחדר (שם), ואם לא היתה ראויה לביאה מבעוד יום, כגון שהיתה טמאה - אסורה לטבול בשבת, דאסור לו לבא עליה בשבת, שהרי מקודם לא קנה אותה כלל, כיון שלא היה יחוד הראוי לביאה (שם ומשיג על החלקת מחוקק, וגם הב"ש שם השיג על החמ"ח ע"ש).