Origins
Agreement is, at its etymological heart, pleasure. The word comes from Old French agreer, meaning 'to receive with favour', built from the phrase à gré — 'to one's liking'. The gré element descends from Latin grātus, 'pleasing' or 'thankful'.
This Latin root is among the most prolific in English. Grace is the quality of being pleasing. Grateful means full of grātus. Gratitude is the state of thankfulness. A gratuity is a gift of thanks. To congratulate is to share in someone's good fortune — literally 'to be pleased together with'.
Development
The shift from 'finding something pleasing' to 'holding the same opinion' happened gradually in English. If two parties both find a proposal to their liking, they agree. The grammatical construction preserves this: we agree to terms (find them acceptable) and agree with people (find their views pleasing).
The word disagreeable retains the oldest sense most clearly. A disagreeable person is not one who holds different opinions — they are simply unpleasant. Not pleasing. Not grātus.