idea: Morals are heuristics for socially optimal behavior
A common cognitive science view (H. Simon):
Heuristics/biases are useful rules-of-thumb to approximate optimizing behavior given computational constraints.
Consider the chess-playing heuristic "try not to lose your queen". Since you can't analyze all possible chess moves, it's nice to have such a rule-of-thumb to narrow down possible actions to consider. You can reject out of hand an action that leads to losing your queen. This heuristic helps to approximate optimal chess-playing behavior given your computational constraints.
Similarly, moral rules, tendencies, associations, and ontologies are heuristics to approximate socially optimal behavior. "Lying is bad" is a useful rule-of-thumb that usually gets good results for society. Codifying it as a norm -- meaning, there's 3rd party punishment and/or self-punishment (guilt) when it's violated, thus the rule should get obeyed -- is the implementation of a social-level heuristic that generally gives useful behavior.
Just like this Simonian definition of a heuristic, "Lying is bad" is necessary due to computational and informational limitations. You can't foresee very well that lying could cause trouble down the road. In fact, you may be pretty sure it could give good results in the short-term. However, since it's usually actually bad, a norm against it may be overall socially beneficial. Then for learning or group selection reasons (people imitate successful strategies, groups with the norm outcompete other groups), a socially beneficial norm may take root and spread.
That does not mean "lying is bad" is some sort of universal truth, or even that it can be evaluated as a truth-functional statement (that is, must resolve to true/false in a certain world). That would imply there is are actually definite sets of good and bad things. Instead, it may be useful to think of a fictionalist explanation: this moral ontology of goodness/badness is a pragmatically useful fiction (useful because it helps bring about a just and orderly world.) Specifically, it does this by functioning as a computational shortcut.
Of course, whether morals are real or not should be irrelevant for a behavioral analysis of morality, but that issue always seems to get dragged in anyway, perhaps because we seem to care about it a lot.