From 1385 onwards, Poland and the Grand Duchy of Lithuania functioned as two separate states ruled by a single monarch. Initially, only Poland favoured the idea to deepen the union. In time, however, the Lithuanian szlachta (gentry/nobility), seeking to acquire political rights similar to those of the Polish szlachta, came to support the concept. Lest Lithuania and Poland might each elect their own ruler after his childless death, King Zygmunt II August (Sigismund II Augustus) (1548-1572) endeavoured to strengthen the ties between the two countries. Although the Lithuanian magnates had long resisted a closer union, their drawn-out war against Muscovy finally forced them to seek support from the Crown.
From January 1569, the Polish and Lithuanian parliaments (sejms) held their debates in parallel, bargaining for a union agreement. The deliberations were acrimonious, but eventually led to the signing, in Lublin, of an act of real union between the Crown and the Grand Duchy of Lithuania. This happened on July 1, 1569.
The Union of Lublin provided for the merger of the two sovereign countries, Poland and Lithuania, into a single unit that became called ‘the Commonwealth [Rzeczpospolita] of the Two Nations’, to be ruled by a single monarch elected jointly by the two nations in free elections. The Rzeczpospolita was henceforth to have a joint Sejm (parliament) and a shared foreign policy. The central offices specific to each of the countries were preserved, as were their respective official languages, armies, treasuries, and judicial systems. A single currency was also introduced – however, it was minted separately in each of the two countries.
Here you can find full text of the document: http://polishfreedom.pl/en/document/the-union-of-lublin