Given a choice to pause and ponder versus jumping in and saying something that you might regret, I would always pick the latter.
Most of the time, people who are 'quick-witted' have either come across the situation before and recalled a good response (think chess players memorizing good opening or endgame moves), or that they are actually really good at analyzing and solving a particular type of problem really well (think prodigies that have an abundance of natural talent).
This is something that you can practice by listening to what other people say and analyzing the situation rather than jumping in with a comment of your own.
In time, you'll be the one jumping in with the 'quick-witted' comment.