The military alliance between the United Kingdom and Poland was formalised by the Anglo-Polish Agreement in 1939 and subsequent addenda of 1940 and 1944, for mutual assistance in case of military invasion from Germany, as specified in a secret protocol.
On March 31, 1939, in response to Nazi Germany's defiance of the Munich Agreement and occupation of Czechoslovakia, the United Kingdom pledged the support of itself and France to guarantee Polish independence.
... in the event of any action which clearly threatened Polish independence, and which the Polish Government accordingly considered it vital to resist with their national forces, His Majesty's Government would feel themselves bound at once to lend the Polish Government all support in their power. They have given the Polish Government an assurance to this effect.
I may add that the French Government have authorised me to make it plain that they stand in the same position in this matter as do His Majesty's Government.
On April 6, during a visit to London by the Polish foreign minister, it was agreed to formalise the guarantee as an Anglo-Polish military alliance, pending negotiations.
This guarantee was extended on April 13 to Greece and Romania following Italy's invasion of Albania.
On August 25, two days after the Nazi-Soviet Pact, the Agreement of Mutual Assistance between the United Kingdom and Poland was signed. The agreement contained promises of mutual military assistance between the nations in the event either was attacked by some "European country". The United Kingdom, sensing a dangerous trend of German expansionism, sought to prevent German aggression by this show of solidarity. In a secret protocol of the pact, the United Kingdom offered assistance in the case of an attack on Poland specifically by Germany, while in the case of attack by other countries the parties were required to "consult together on measures to be taken in common". Both the United Kingdom and Poland were bound not to enter agreements with any other third countries which were a threat to the other. Because of the pact's signing, Hitler postponed his planned invasion of Poland from August 26 until September 1.