The proverb “Cuando las barbas de tu vecino veas afeitar, pon las tuyas a remojar” that we can translate into English as “if you want to make peace, prepare for war” is meant to teach that when something happens near to you, the same could happen to yourself. For this reason you should be ready or try to avoid it.
It comes from a very old Latin saying: “Barbam propinqui radere, heus, cum videris, prabe lavandos barbula prudens pilos”
The origin of this proverb is quite simple to understand: barbers use to soak the costumer’s beard with hot water in order to make the shave easier. So, while barber is shaving a client’s beard, he prepares the other client by soaking his beard in order to be ready when the first one has done.
This way, when we see shaving the beard of our neighbor, we know the next will be us, so we can be ready for when it is our turn.