The origins of the Shulhan Arukh lie in Rabbi Joseph Caro's earlier work, the Beit Yosef ("House of Joseph") a detailed commentary to the Tur in which Caro carefully examined every law in the earlier code, showing the sources in Talmudic and medieval rabbinic literature, and comparing the interpretations and rulings of the leading medieval authorities. The Shulhan Arukh summarizes the conclusions of the Beit Yosef.
In general, Caro based his decisions on three leading pillars of Jewish codification:
In cases of disagreement among those three, Caro usually followed the majority position.
Although some Rabbis initially opposed basing religious law on a summary code, rather than going back to the original legal sources, the Shulhan Arukh rapidly came to be accepted in almost all Jewish communities as the most authoritative statement of normative religious law. In recent generations, acceptance of the Shulhan Arukh has come to be regarded as a defining criterion of religious Orthodoxy and traditionalism.
Isserles perceived a serious shortcoming in Caro's work, in that it was based almost entirely on Spanish (Sepharadic) authorities. Of the three principal pillars of the Shulhan Arukh, only Asheri had non-Sepharadic roots, having lived most of his life in Germany before moving to Spain. However his legal compendium had been written in the the Spanish spirit.
Thus it was evident that, in spite of its great virtues, the Shulhan Arukh could not be accepted by Jewish communities in Germany and Poland without some modification. Isserles sought to perform this service with his glosses, in which he supplemented the rulings of Caro's original Shulhan Arukh with material drawn from the laws, interpretations and customs of Franco-German and Polish Jewry.
All standard printed editions of the Shulhan Arukh include Isserles' notes, embedded in the text (introduced as "Hagahah ["gloss']), but distinguished by its semi-cursive ("Rashi") script. When people refer to the "Shulhan Arukh" they are usually thinking of the combination of Caro's and Isserles' works.