Jewish fasting occurred in several settings, including mourning, repentance and religious devotion. Weddings represented the opposite social atmosphere: celebration, feasting and joy.
Jesus therefore frames the question in terms of appropriate timing. Wedding attendants do not ordinarily mourn while the bridegroom is present; a time for mourning and fasting will come when he is taken away.