The Pharisees are stunned by Jesus' answer to the loaded question in regards to taxes, departing from Him only to be replaced by some Sadducees, who have made limited appearances in the Gospel record to this point. In fact, until now they have been rather marginal characters in the story. They have been mentioned by John the Baptist in the third chapter and by Jesus in the sixteenth chapter, but only in pairings with the Pharisees (though the two groups had major disagreements and were far from monolithic in their worldviews). Mark and Luke make no mention of them at all up until this same point, and they are completely absent from the Gospel of John. They do have a presence in Acts in connection with Peter and John’s arrest at the Temple and in connection with Paul’s arrest, which also took place at the Temple (a fact that should not be lost from view when dealing with the issue of the Temple).
These may be useful bits of information, as even though Acts was composed after Luke (and as the second part of Luke), the stories of Peter, John, and Paul’s arrest at the Temple, along with the “trials” that took place in connection with those arrests (all of which were carried out by the Temple authorities) were probably fairly well known to the early Christian community. If this is the case, it is possible to presume that these stories that included the Sadducees would have been known to the respective audiences of the Gospels, because just as Israel defined itself by its history and the stories that they told about themselves that had the oppression of Egypt and the exodus as foundational, so too would the early Christian community seek to define itself, in strong Jewish fashion, by telling its own stories of oppression and deliverance (exile and exodus). It is not a stretch to consider the possibility that this type of thing was already taking place in the community for which Matthew primarily composed his Gospel, especially when one is quite easily able to look through Matthew’s lens so as to see Herod as a new Pharaoh ordering the death of children, which is unique to the Matthean narrative.
So even though this is the first time that the Sadducees are going to speak, they are a group that is known to the community. The Gospel authors make it a point to share some basic information about this group, informing (reminding) their audiences that the Sadducees say that there is no resurrection (in reference to the belief in the general resurrection of the dead at the end of the present age). Obviously this editorial comment carries significant weight for a post-Resurrection audience, and it would be a major point of contention for those that are claiming Jesus as their risen Lord and Messiah (King) of Isreal and by extension the entirety of the cosmos. Clearly, there is no respect whatsoever for the Sadducees, as they are almost comically presented, asking Jesus a ridiculously framed question about marriage in the resurrection (seven brothers, all having married the same woman, and all of which died---though there may be a mild allusion to the seven brothers of the Maccabean histories, who certainly hoped for a resurrection).