It's a cognate of the Latin word "merces" (meaning "reward, payment, wages, price, goods"). This word entered the French language and evolved into "merci", which then was borrowed into Old English during the Norman Conquest.
It's important to note that the word "merci" is not related to the Old English word "mercy", which has its own Germanic roots.