The correct sentence that uses the direct object pronoun to substitute the direct object "el jabón" (which is masculine and singular) is:
Ayer lo compré.
This is because "lo" is the appropriate pronoun to replace the masculine singular noun "jabón."