Although this quote applies loosely to the chivalric code put forth by the legendary King Arthur and the Knights of the Round Table, it is not contained within Sir Gawain and the Green Knight. I say "loosely" because, from what I understand, it can only be found within the context of the movie First Knight.
Spoken by King Arthur to Lancelot and inscribed upon the famed "round table," this quote exemplifies both the loyalty and the valor of this medieval code. Therefore, in regards to literature, perhaps we can relate this quote best to famous pieces of literature such as Idylls of the King, Morte d'Arthur and Sir Gawain and the Green Knight which most definitely deal with the code of chivalry.
Just because King Arthur is legendary and this quote imagined doesn't mean that we can't appreciate it for what it's worth, however. It deals with loyalty, certainly an admirable quality. These Knights of the Round Table certainly had loyalty to God, their country, and their king above all else. The knights were there to serve and, in so doing, keep Christendom free from the enemy. Protecting and serving the community is still valued even in society today. In that, we can say that this code of chivalry is certainly not "dead," as some people claim.
The code of chivalry had some particular indicators of nobility, which was still able to be achieved even through war that they considered to be the "serving each other" in the quote above. No one should ever attack from the back. No torture was allowed. No unprepared opponent should be set upon. Above all, justice should be administered.
For example in Sir Gawain and the Green Knight chivalry can easily be found in the following lines:
Now take care, Sir Gawain, / That your courage wax not cold / When you must turn again / To your enterprise foretold.
Of course, Sir Gawain takes up his quest and is eventually rewarded, ... as is King Arthur in Morte d'Arthur. Chivalry peppers this text and summed up nicely in the following quote:
Do after the good and leave the evil, and it shall bring you to good fame and renown.
Ironically, if you change one little word of the quote within your question to read "by serving each other we become free," I have heard it applied to everything from football, to Tibetan and Mongolian wisdom, and even within the confines of Christianity to exemplify the best way to live one's life in Christ!