The 1874 Brussels Convention banned chemical weapon and poisonous weapons in war, yet WWI had chemical weapons.
The 1925 Geneva Conventions prohibited the use of chemical warfare, and there weren't uses of chemical weapons on the battlefield in WWII
What changed? What made those countries obligated to follow the Geneva Conventions, but not the Brussels Convention?
I just want to clarify two things before I dig into my answer:
The Brussels Declaration never entered into force, although it did influence the content of the 1899 Hague Convention; and, the 1925 Geneva Protocol has a very mixed record of success.
The short version of this answer, from a legal perspective, is that WW1 can be characterised as either a situation of legal impunity, a si omnes situation, or an exercise of belligerent reprisal. As a result, saying the law was "violated' isn't necessarily correct. The law has since changed and modern international humanitarian law treaties don't allow the same kinds of derogations.
I'm going to answer first what obligations States had under the Convention and the Protocol, and then briefly explain the effects of the Geneva Conventions and the CWC.
What obligations did states have to comply with the Hague Convention and Geneva Protocol?
Before WW1, the law governing chemical weapons/asphyxiating gases was part of the Hague Conventions. The use of asphyxiating gas during war was prohibited. However, there were several limitations on this:
As for the Geneva Protocol:
All this means that already, from a legal perspective, latitude to violate or ignore the Geneva Protocol was more limited. That doesn't mean it was necessarily successful all the time; chemical weapons might not have been particularly popular tools during WW2 (in part because of the shared experience of suffering on the European continent), but they were still used, for example, in the Italian invasion of Abyssinia.
The Geneva Conventions and the CWC
After WW2, the entire way that we approach the laws of war changed. There was a shift away from simply regulating the means and methods of warfare (the Hague rules) and into the protection of different categories of person (the Geneva rules). When people talk about the Geneva Conventions, this second set of rules is what they actually mean - things like prohibitions on collective punishment, an explicit ban on targeting of civilians, protections for hospitals and so on. They also include, for example, restrictions on the use of indiscriminate attacks. These rules are generally accepted as* part of customary international law, meaning they bind all countries. This shift can be seen as the beginning of a process called humanisation, which is the idea that the laws of war have become more attuned to the fact that human lives are involved.
It's also no longer clear, today, if a reprisal in the form of a chemical attack following another chemical attack is allowed. The rule hasn't really been tested, and although it's allowed under the Geneva Protocol, the more recent treaty - the Chemical Weapons Convention - prohibits reservations, and the use of chemical weapons would violate it.
Lastly, the prohibition on the use of chemical weapons appears to have become a rule of customary international law (I unfortunately can't get into great depth on this point because the ICRC customary IHL study, in which the rule is most clearly illustrated, was released within the last 20 years, but if you're interested it's rule 74 and there is an in-depth analysis of the historic practice that created the rule). This means that between the actions of states and opinio juris (expressions of the belief of the existence of a binding rule), an unwritten rule has come into existence which binds all states, including those few who are not party to the Geneva Protocol or CWC. Customary law exists alongside treaty law, so certain countries are bound by three restrictive sets of laws at once.
So, all told, to answer your questions:
edit to add: I want to contest the assertion in another answer that the laws of war are gentleman's agreements. They are much more than that, and represent a limiting factor on conduct in situations that have potential to be indescribably inhumane. Even when the rules are violated, states justify that breach with reference to exceptions contained within the rule; this, in itself, strengthens the rule. The Geneva Conventions, Hague Convention and the disarmament treaties are overall resounding successes, and the reason why violations of them make the news is precisely because they are the exception, not the rule. Certain aspects of the legal framework do derive from concepts of chivalry and moral conduct, but they are still laws.
If they were simply a series of rules to break when convenient, we would expect to see far more widespread violations and far less coverage thereof, and we certainly wouldn't be able to explain the existence of the ICC, ITCY, ICTR, SCSL, and the STL, nor the IIM-M, the IIIM-S, or the prosecution of war crimes in domestic courts under universal jurisdiction, or the decisions of the International Court of Justice relating to armed conflict including the Nicaragua case, the Armed Activities case involving Congo, or the Oil Platforms case. Sadly, there isn't enough space to elaborate on the cases and entities mentioned here, some of which fall outside of the 20-year rule.
*Most recent edit: fixed some typos in the last paragraph, added "generally accepted as" when discussing customary law.