As the Daily Mail and Express points out:
Several other NATO countries have the powerful Leopard 2 tanks (pictured, file photo) in their arsenals and have expressed their wish to send some to Ukraine. However, any such move would require sign-off from the German government.
... Poland, Lithuania, Estonia, Slovakia and the Czech Republic have all publicly said on Thursday and Friday that they are willing to send their Leopard 2 models to Ukraine pending German approval ... But on Wednesday, Chancellor Scholz allegedly told US lawmakers that Germany had no plans to send the Leopard 2 tanks to Ukraine, nor would they permit other countries to do so.
Should countries in possession of the German-made tanks proceed without Mr Scholz’s approval, they would risk defence contracts with Germany being permanently cancelled, leaving them increasingly vulnerable to foreign attacks.
Thus, it is clear that that German-Poland Defence agreements prohibits Poland from giving German weaponry to Ukraine (or any other country) without Germany's permission. If it happens, Poland - Germany relationship will deteriorate.
The "minor" reasons why such conditions are included in defence contract are economics - weapon manufacturers, like any other business, don't like their used and second-hands products entering the market again as the free or cheaper versions hurt their business. But more important than that, the origin countries of these weapons have their own political concerns of the weapons falling into enemy hands or with their competitors or provoking another country to become hostile towards them.
Thus, the diplomatic negotiations and contractual terms stipulate strict terms on who these weapons are intended for (e.g. only military, and not police) and what should be done with when the weapons are no longer viable or have outlived their life.
Some more examples:
The United States is especially famous for including very intrusive terms in contracts that even allow for inspection of the weapons onsite (US military now doing onsite weapons inspections in Ukraine).
Some of their terms even prohibiting modifying or upgrading their weapons in any manner without their explicit permission:
In Indian experience, when we acquired weapon systems, we exercised total ownership. It is not apparently so with military equipment of US origin ... The US has not permitted any country procuring their military hardware to modify or technically alter without their consent and participation ... EUMA and other related instruments could well prohibit India from choosing sensors and weapon systems of its choice for the aircraft from sources other than the US, forever. While we have adapted sensors and weapon systems of origin other than Russian on the SU-30MKI, the US will not permit India to adapt sub-systems, weapons and munitions of non-US origin, especially from Russia on US machines in Indian inventory. (Source: End-Use Monitoring Agreement (EUMA): Buyer Beware).
This is one of the major reasons that the Indian government and military prefer buying arms from Russia, Europe, Israel etc., as they don't include such intrusive and objectionable terms. But India still has to adhere to some Russian terms and especially be conscious to Russia's security concerns.
For example, when Indo-US military relationships improved, and India and the US wanted to conduct joint military exercises between the Indian Air Force (IAF) and the US Air Force, the indian government informed the Russian government about this planned exercise. This was necessary as the bulk of IAF's fighter jets are of Russian origins. The Russian government sought information on what exercises would be done, and in turn placed some restrictions on the weapons and fighter jets that could be used in the exercise. This was to prevent the US military from obtaining data about Russian weaponry. The US Air Force similarly placed their own conditions to ensure no military data could leak to the Russian side. (Cope India Exercise).
Poland, under its right-wing totalitarian government, however seems to have been preparing for break down in military relationship with Germany and is already buying more weapons from the USA and South Korea - Meet Europe’s coming military superpower: Poland.