how do you do this

This is a unit conversion problem, which takes advantage of the fact that multiplying something by 1 does not alter it. For example:

1 foot = 12 inches, so we can also say that 1 = 1 ft / 12 in. If we have 6 inches and want to convert that to feet:

6 in= 6 in * 1 = 6 in * (1 ft / 12 in) = 6 in * (1 ft / 12 in) = (6/12) ft = (1/2) ft, or 0.5 ft. [Note the the units need to cancel]

For this problem we need to connect gals to qts (1 gal = 4 qt) and seconds to minutes (60s = 1 min).

Putting this all together:

12 gal/s = 12 gal/s * 1*1 = 12 gal/s * (4 qt / gal) * (60s/ 1min) = 12 gal/s * (4 qt / gal) * (60s/ 1min) = 12 * 4 qt * (60/min) = 12 * 4 * 60 (qt/min) = 2880 qt/min

Again, look at how the units canceled out leaving you with what you needed.