late 14c., "to give consent, assent," from Old French agreer "to please, satisfy; to receive with favor, take pleasure in" (12c.), a contraction of phrase a gré "favorably, of good will," literally "to (one's) liking" (or a like contraction in Medieval Latin) from a, from Latin ad "to" (see ad-) + Old French gre, gret "that which pleases," from Latin gratum, neuter of gratus "pleasing, welcome, agreeable" (from suffixed form of PIE root *gwere- (2) "to favor").
In Middle English also "to please, gratify, satisfy," a sense preserved in agreeable. Of parties, "come to agreement; make a settlement," mid-15c.; meaning "to be in harmony in opinions" is from late 15c. Of things, "to coincide," from 1520s. To agree to differ is from 1785 (also agree to disagree, 1792). Related: Agreed; agreeing.