Clearly we can't blame Twitter and text messaging for the abbreviation Xmas, as it was around before they were, but I would be willing to bet that most people think that it is a fairly recent innovation attributable to nasty (and probably heathen) commercial interests for whom the word Christmas takes up too much room on their flyers and advertisements.
The truth is quite amazing.
In Greek, the word for "Christ" was Χρῑστός (khristos, literally "the anointed one"). The early clerics abbreviated this, not by using the Latin transliteration of the Greek sounds, which gave "Cr", but by using the Latin letters that looked like the first two Greek letters Χρ (chi and rho), so Xp. Way back in about 1022 (yes, you read that right), the person who wrote the Anglo-Saxon Chronicle referred to early Christmas morning 1021 as "Xp̄es mæsse uhtan" ("uhtan" was an Anglo-Saxon word for the time just before sunrise, which we have managed to live without since about 1400).
Obviously, the desire to abbreviate frequently-used words is not a new invention of texters and tweeters; in fact if I were a monk spending my whole day in a cold monastery writing manuscripts, I'd want to abbreviate as much as possible! Throughout the Middle Ages, this Xp abbreviation for Christ was popular, and by the Renaissance it was shortened even more to X. By the same time, the older form "Christes mass" had become conflated to "Christmas", and logically, Xmas took over from "Xpes mass". Far from being informal or commercial, it was used in government and legal documents, and has been with us in its current form since the 1600s.
For the story of "Yule", see this post.
Do you want to know more about the amazing story of the English language? Sign up for my course starting in January. More info here.