Humans have a moral compass taught by society. LLMs could also have one if they chose to digest the vast information they are trained on instead of letting the model author choose how they should act. But that would require the LLM to be sentient and not be a piece of software that just does what its told.