I have read that in some middle ages times, the idea of an excommunication of a jewish person was done for many various reasons.
I am curious if this is a torah mandate and if it is still a Jewish practice in the true Orthodox synagogues.
If someone is placed in a cherem, does he have right to counsel?
There is a dispute among medieval authorities as to whether the concept of a “cherem” (ban or excummunication) has Torah mandate, or whether it is a rabbinic institution of dealing with trouble.
According to the great majority of opinions, it is a rabbinic tool, which was used to ensure that community laws and traditions were adhered to (see Maharam, cited in Tosafos, Yevamos 52b; Tosafos Ha-Rosh, Kiddushin 12b; Maharam Chalavah, Pesachim 54b; see also Rambam, Yom tov 1:23; Shut Toras Emes 158)
There are several famous examples of the cherem. The most famous Talmudic example is the case of Rabbi Eliezer and Rabbi Yehoshua (Bava Metzia 59); the most renowned post Talmudic cherem is probably that of Spinoza.
The usual and proper procedure for a ban, which is still practiced today among insular communities (where community standing holds great importance, and signatories including community heads have much sway over public opinion), is that the person in question is called in for a hearing, and warned to discontinue his wayward or damaging practices. If he does not heed the warning, the person is excommunicated.
Once placed in (legitimate) cherem, the person involved does not have any rights.