mid-15c., "for nothing, freely," from Latin gratis, contraction of gratiis "for thanks," hence, "without recompense, for nothing," ablative of gratiae "thanks," plural of gratia "favor" (from suffixed form of PIE root *gwere- (2) "to favor"). Meaning "free of charge" is 1540s.
gwerə-, Proto-Indo-European root meaning "to favor."
It forms all or part of: agree; bard (n.); congratulate; congratulation; disgrace; grace; gracious; grateful; gratify; gratis; gratitude; gratuitous; gratuity; gratulation; ingrate; ingratiate.
It is the hypothetical source of/evidence for its existence is provided by: Sanskrit grnati "sings, praises, announces;" Avestan gar- "to praise;" Lithuanian giriu, girti "to praise, celebrate;" Old Celtic bardos "poet, singer."