You are correct in that 'to observe' can be used here and it would make sense. (although the verb more commonly means to look upon something). 'To obey' is a bit more formal. 'To obey' just means to follows rules or laws, or to follow the will of someone, something, or multiple people. ex.: "An aircraft in flight obviously will always obey the laws of physics." "Many people put a lot of effort into seeing that their dogs know how to obey commands."