Loyalty is a poorly understood gameplay mechanic. It influences how likely a recently-recruited companion is to stay with the party when an expedition ends. It may also influence the likelihood of companions deserting the party mid-expedition. 

Companions' loyalty is affected when their ailments are ignored (during events?)

Low loyalty may give a companion the Angry ailment.

Loyalty can be improved by giving a companion a Native Trinket.