Origins of szlachta can be probably traced to Slavic class of free warriors, but it's far from being certain, as we have very little documentation on early history of Poland.
There were many differences between Szlachta and Noblemen in other countries. Two most important were that the king was elected by all members of Szlachta, during Jagielonian Dynasty from all members of dynasty, and later without any limitations. and that no change in law or other important decision like taxation or going to war could be made by decision of king, but all changes were made by representants of Szlachta from all lands during Sejm. System was quite complex - many types of laws required unanimity (Liberum Veto) of all lands, others just majority.
Poland, despite having a king, was called Republic (Rzeczpospolita) at that time because he was elected and Poland was considered to be property of the class, not of king or ruling dynasty.
Szlachta had many right that no other Noblemen class had. Members of Szlachta could legally make confederations, that is armed rebellions, against the king or state officers if they thought that the law was being broken. There were also more numerable than the usual Noble class - about 10% of population of Poland, and in some regions like Mazowsze even about 30% population was members of Szlachta - while the usual percentage in Europe was more like 1-3%.
Szlachta was also protected by laws similar to Habeas corpus (which act granted them ?) and had many priviledges that were denied to all other classes.
During Reformation, Polish Szlachta became multi-religion. After Contrreformation, when Roman Catholic Church went to power in Poland, it became almost Catholic-only, despite Catholics not being majority religion in Poland. (Both Catholic and Orthodox church had between 40% and 50% (numbers uncertain - need some checking) of population as their worshippers at various time, there were also a lot of Jews and Protestants at that time).
See also: History of Poland