Outer surface of teeth is made up of enamel, which is made up of Calcium Phosphate- Ca₃(PO₄)₂ which does not dissolve in water but gets decayed when the pH of inner side of mouth becomes less than 5.5

Also acid is produced inside the mouth by decomposition of saccharides (sugar) and food particles by bacteria inside the mouth after taking meals.

So the toothpastes are basic in nature which neutralize the acid produced in the mouth. In this way they prevent the pH value of inner side of mouth to drop below 5.5 and hence prevent the teeth from decaying.
Now in our mouth and in digestive system when food breaks down en acid is formed. too much concentration of acid is bad for us. Now it's a fact that our teeth starts decaying when ph value of acid in our mouth comes less than 5.5. to prevent our tooth decaying toothpastes are basic in nature so that they can neutralise the excess acid so to prevent our teeth.