The humour in this scene comes through the role and action of Sir Toby in fooling both Viola and Sir Andrew into thinking that the other is a virtuoso with a sword and therefore having a great deal of fun on the behalf of both characters. In reality, of course, Sir Toby knows that both Sir Andrew and Viola are not skilled with a sword, but because he is a force for chaos in the play, he cannot resist to make a joke out of this comic situation and exploit it for his own purposes. Note what he says to Viola, after Sir Tony has just been asked by Sir Andrew to approach Viola and see if he can escape fighting him:
There's no remedy, sir, he will fight with you for's oath' sake.
Sir Toby says the same to Sir Andrew after Viola has likewise done what she can to stop the fight. The duel is so comic therefore because firstly Sir Andrew accuses Viola of trying to engage the affections of the woman that Sir Andrew is trying to marry, whilst Olivia of course detests Sir Andrew and Viola herself does everything she can not to engage Olivia's affections. In addition, the duel becomes more comic by the deliberate miscommunication that Sir Toby promotes and how he exaggerates the skill of either side to the other party and then twists the messages that they send between them for his own purposes. The comedy of the situation is even further advanced by the fact that Viola is of course no man at all, but a woman disguised as a man, which is something that she admits to the audience:
Pray God defend me. A little thing would make me tell them how much I lack of a man.
Irony and miscommunication abound, making the reality of what is really going on very different from the appearance of that reality.