Many proteins including certain toxins are secreted in their inactive form. They get activated, only when exposed to a specific trigger (pH. temperature etc.). It is advantageous to the bacteria producing it because the bacteria does not get killed due to the action of protein.