Titrating carboxylic acid with a strong base forms a carboxylate salt. The carboxylate anion can then serve as a nucleophile in an SN2 reaction upon a primary or secondary alkyl halide to form an ester.
Watch out for mechanisms on the MCAT where a carboxylate nucleophile is being employed in this
manner because it's easy to fall into the assumption that a pathway from one carboxylic acid derivative to another must be following an acyl substitution pattern.