It is a tricky sentence. If который
immediately follows a noun, it does not neccessarily refer to this noun. In rare cases, it may refer to any previous noun in the sentence. You encountered such a case.
If который
refers to the immediately preceding noun, it is separated by comma, and matches the noun in number, case, and (if relevant) gender.
It который
refers to another noun, there is no comma. It matches the noun by number, but the case is governed by the immediately preceding noun. Yes, it is that complicated.
In this sentence, которых
must refer to правил
. One reason is they are both in plural. Other nouns before которых
are in singular. Besides, if it referred to any other noun, the sentence would be ill-formed, and make no sense. Finally, соблюдение правил
is just a common phrase.
If который
referred to соблюдение
, this part of the sentence would be соблюдение, которое обязательно для всех членов общества
(note the comma).
In your case, которых
is in plural because правил
is in plural. Которых
is in genitive because соблюдение
governs genitive.