Medals are skill points that you can earn or lose in Tower Duel; they allow you to differentiate yourself from other competitors by demonstrating your knowledge and match you with users that are on your level, to make the game more challenging.
These will also determine your ranking within a team. For this reason, if two players have the same level, the one with the higher number of medals will prevail.
Both medals earned and lost will depend on how many medals you have at the time. The more you have, the more you can lose, while the fewer you have, the less you lose. Likewise, if you have fewer medals, you will earn more per win, and if you have more, you will receive less per win.