Even though John the Baptist has been thrown into prison (4:12), his disciples are still hanging around and faithfully practicing his teachings. But then they notice that their practice of fasting is more in sync with the Pharisees' practice than with the disciples of Jesus, who don't fast at all. Hmm, they say to themselves, what's wrong with this picture? We're on Jesus' side, not the Pharisees'.
They seek Jesus out to ask him about it. "Why do we and the Pharisees fast, but your disciples do not fast?" Jesus answers, "The attendants of the bridegroom cannot mourn as long as the bridegroom is with them, can they?" By referring to fasting as mourning, Jesus explains the purpose of this Old Testament practice. You fast because you are mourning, and you are mourning because of your sin. David fasted over his infant child who lay on the brink of death because of his sin with Bathsheba (2 Samuel 12:15-23). Esther and her people fasted for three days before she risked her life to make request of the king (Esther 4:15-17). Esther and the Jews mourned because all their lives were in danger, but ultimately they understood that their sin, which had brought them into exile, was the root cause of their perilous situation.
So when you get down to it, fasting is mourning that the Messiah has not yet come. The Answer to all your griefs and sorrows has not yet arrived. But if he has arrived, why still mourn as if he were away? That's the point of Jesus' parable about the bridegroom and his attendants. When the bridegroom is here the attendants are joyful, but when he is taken away they will mourn again. Here = happy. Not here = sad.
The Old Testament is all about waiting for the bridegroom to arrive. The whole story is colored with sorrow and longing for better days. The arrival of Jesus, however, signals the beginning of something new. The New Testamant era is the time of rejoicing because the Messiah has come to bear away our sins. That's what Jesus is talking about when he gives the analogy of how you don't sew a new patch onto an old garment, or pour new wine into old wineskins. The new situation doesn't mesh with the old practices. A new patch will tear away from the old fabric and newly fermenting wine will bust out of brittle old wineskins. Likewise the good news of the Messiah's arrival doesn't mesh with fasting and mourning for the Messiah to come. He has come. Stop mourning.
Jesus refers to a time when once again "the bridegroom is taken away from [the attendants], and then they will fast." Jesus kind of hints that the practice of fasting still remains today in his temporary absence, but he also makes clear that his coming has transformed the practice into something new. We live in a time when Jesus is both absent and present, when we both grieve and rejoice. Like Paul says we are "as sorrowful yet always rejoicing, as poor yet making many rich, as having nothing yet possessing all things" (2 Corinthians 6:10). That's because Jesus has established his kingdom in our hearts though he has not yet established it in the world. So we live with one foot in this reality and another foot in that reality. Sad and yet happy. Having reason to fast, and yet never again fasting with the same sorrow the Old Testament saints once had.