On the first Shabbos after Moshe had informed the Jewish people that no מן would fall on Shabbos, but that instead a double portion would fall on Friday, he told the people, "אכלוהו היום כי שבת היום לה' היום לא תמצאהו בשדה," meaning that they should eat the remainder of Friday's portion today because today is Shabbos, and they will find no מן in the field today )שמות ט"ז:כ"ה(. The Gemara in Shabbos (דף קי"ז:) derives from the fact that the Torah uses the word היום, today, three times in this Posuk that there is an obligation to eat three meals on Shabbos. The Gemara further on (שם דף קי"ח.) documents the great rewards given to one who is careful to always eat these three meals.
The Pri Megadim (אורח חיים סימן רצ"א במשבצות זהב ס"ק א') quotes from the Levush that this obligation is from the Torah; the Sefer Chareidim, in his listing of the Mitzvos from the Torah (פרק י"ד אות ג'), concurs, and asserts that this is the position of Rashi on the first Gemara in Shabbos above (שם בד"ה תלתא). The Taz (שם סימן תע"ב ס"ק א') quotes that the Maharal of Prague held this way as well. This seems, however, to be the minority opinion, as most of the Monei HaMitzvos (those authorities who wrote books listing all the Taryag Mitzvos) do not enumerate this as an independent Mitzvah. The Maharil (שו"ת מהרי"ל סימן צ"ד), among others, writes that this obligation is MideRabbanan, and the Pri Megadim cited above assumes this as well. The Aruch HaShulchan (או"ח סימן רצ"א סעיף א') suggests that this Mitzvah was instituted by Moshe Rabbeinu, and that the three Shabbos meals hint at various important ideas, as mentioned in the Tur (או"ח שם). Whatever the origin, the Rambam (פרק ל' מהל' שבת הלכה ט') writes that one must be sure to eat no less than three meals on Shabbos, one in the evening, one in the morning, and one in the afternoon, even if one is very poor.
The Shulchan Aruch (או"ח שם סעיף א') stresses that one must be extremely careful to eat Shalosh Seudos (the third meal) even if one is not hungry. The Kaf HaChaim (שם ס"ק ג')quotes from the Chida that this extra effort for Shalosh Seudos is necessary because one would normally eat a meal on Friday night and some time on Shabbos morning anyway, even were it not required (עיין סוכה דף כ"ז.), while one would probably not otherwise eat late in the afternoon. Shalosh Seudos, then, is the meal which clearly is being eaten only in order to honor Shabbos and thus by eating then, one indicates that the other two meals too were actually eaten in honor of Shabbos. The Shulchan Aruch (שם) says that one need not, of course, risk making one's self sick by eating Shalosh Seudos if one is so full; the purpose of the meal, as the Mishnah Berurah (שם ס"ק ג') points out, is to give one pleasure, and not pain. But one should, the Shulchan Aruch (שם) adds, have enough foresight to eat a little less at lunchtime in order to be able to eat Shalosh Seudos and enjoy it.
Tosafos in Shabbos (דף קי"ח. בד"ה במנחה) derive from the Gemara there that Shalosh Seudos may not be eaten earlier than Minchah time, which is approximately half an hour after mid-day. The Rosh (שם פרק ט"ז סימן ה') agrees, and although the Ran (שם דף מ"ג: בדפי הרי"ף בד"ה ת"ר כמה) quotes a view that there is no fixed time for Shalosh Seudos, the Shulchan Aruch (שם סעיף ב') rules that Shalosh Seudos must be eaten starting half an hour past mid-day. One should also not begin Shalosh Seudos after it gets dark, as the Shulchan Aruch (או"ח סימן רצ"ט סעיף א') rules that one cannot eat at that point; the Mishnah Berurah (שם ס"ק א') quotes that this cut-off time is actually sunset, although there is some discussion about that (עיין שם בביאור הלכה בד"ה משתחשך), and he himself allows one to begin Shalosh Seudos as late as half an hour before nightfall. Rav Moshe Feinstein (שו"ת אגרות משה או"ח חלק ד' סימן ס"ט אות ו') questions this leniency and says that the cut-off point is earlier. The Shulchan Aruch (שם) adds, however, that if one began eating earlier, and the meal extended even until after dark, one may continue eating. Although another view is quoted, the Ramo (שם) asserts that the first one is correct. As far as davening Minchah, Rabbeinu Tam is quoted in Tosafos in Pesachim (דף ק"ה. בד"ה והנ"מ) as confirming the Minhag that one shouldn't eat between Minchah and Maariv, and the Rosh שם פרק י' סימן י"ג() agrees. Shalosh Seudos, then, should be eaten before Minchah. The Rambam, however )הל' שבת שם הלכה י'(, writes that one should daven Minchah before eating Shalosh Seudos, and the Hagahos Maimoniyos )שם אות כ'( concurs, quoting a different version of Rabbeinu Tam's view.The Ramo )או"ח סימן רצ"א סעיף ב'( quotes both opinions, expressing that the latter is more commonly followed; Shalosh Seudos thus generally follows Minchah. The Mishnah Berurah adds, however )שם ס"ק י"א(, that if for some reason one cannot eat after Minchah, one fulfills the Mitzvah fully if he eats beforehand.
What kind of food constitutes a proper Shalosh Seudos? Tosafos in Yoma (דף ע"ט: בד"ה מיני) hold that one must eat bread because of the connection between Shalosh Seudos and the מן which replaced bread; many other Rishonim agree. The Tur (סימן רצ"א), quoting his father the Rosh, and the Rambam שם הלכה( ט') both rule that one should have Lechem Mishneh for Shalosh Seudos as well;the Shulchan Aruch שם סעיף ד'() accepts this view. Tosafos in Berachos, however )דף מ"ט: בד"ה אי(, quotes Rabbeinu Tam as holding that one may eat other foods at Shalosh Seudos as well and need not eat bread; Rabbeinu Yonah (שם דף ל"ו: בדפי הרי"ף בד"ה ברכת) and others concur. The Shulchan Aruch (שם סעיף ה') rules that one must have bread, but if one is overly full, one may eat other Mezonos foods, or even meat or fish, as allowed by Tosafos (שם) or perhaps even just fruit, as allowed by Rabbeinu Yonah )שם(, and the Ran (לשבת דף מ"ד. בדפי הרי"ף בד"ה ואיכא). The Aruch HaShulchan (שם סעיף י"ב), though, writes in strong terms that it is highly improper to be lenient and eat other foods and not bread, unless one is ill.
It is worth noting that Rabbeinu Tam, in his Sefer HaYashar (חלק השו"ת סימן ע אות ד'), rules that women too are obligated to eat Shalosh Seudos, because אף הן היו באותו הנס, meaning that they too benefitted from the miracle of the מן; many Poskim quote and agree with this ruling. The Ran (לשבת שם בד"ה וכתב) cites another reason: women are obligated in all the positive Mitzvos of Shabbos just as men are, as indicated by the Gemara in Berachos (דף כ:). The Shulchan Aruch (שם סעיף ו') thus rules that women must eat Shalosh Seudos; the Aruch HaShulchan (שם סעיף ד') notes that many women are unaware of this and ought to be told that they too should be careful to observe this important Mitzvah.