Amines serve as nucleophiles in attacking the sulfonyl chloride electrophile, displacing chloride. The sulfonamides resulting from primary and secondary amines are poorly soluble and precipitate as solids from solution.  
For primary amines (R' = H), the initially formed sulfonamide is deprotonated by base to give a water-soluble sulfonamide salt (Na[PhSONR]).
Tertiary amines promote hydrolysis of the sulfonyl chloride functional group, which affords water-soluble sulfonate salts.