The origins of the szlachta can be probably traced to a Slavic class of free warriors. However, this is far from being certain, as there is very little documentation on the early history of Poland.
There were many differences between Szlachta and noblemen in other countries. Two of the most important differences were that the king was elected by all members of the Szlachta, and that no change in law or other important decision like taxation or going to war could be made by unilateral decision of king, but instead, all changes were made by representants of the Szlachta from all lands during the Sejm. During the Jagiellonian Dynasty, candidates were chosen from all members of dynasty; later, there were no limitations on the choice of candidates.
The system was quite complex - many types of laws required unanimity (Liberum Veto) of all lands, others just majority. Despite having a king, Poland was called the Republic (Rzeczpospolita) at that time because the king was elected and Poland was considered to be property of the class, not of king or ruling dynasty.
Szlachta had many rights 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. Szlachta 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 were members of the Szlachta - while the usual percentage in Europe was closer to 1-3% (with the exception of Spain).
Until the Reformation, the Polish Szlachta were mostly Catholic or Orthodox. However, many families adopted reformed religionsvery fast. After the Counter-Reformation, when the Roman Catholic Church regained power in Poland, it became almost Catholic-only, despite Catholics not being the majority religion in Poland. (Both Catholic and Orthodox churches had approximately 40% of population as their worshippers at various time, while the remaining 20% were Jews and members of various Protestant churches).