Bishops are assigned to a diocese “indefinitely.” The general idea is that a Bishop who becomes the Ordinary of a diocese is there for life. However, obviously, certain needs in the universal Church occasionally require a Bishop to be moved to a different diocese or assignment in the Church.
Bishops are assigned by the Pope. While the Pope receives advice from the Papal Nuncio of the country involved and the Congregation for Bishops, the decision is the Pope’s alone.
Diocesan priests are considered part of the diocese for life. There are, of course, exceptions that occur. In such cases the priest must request to be transferred to outside the diocese, his Bishop must agree, and another Bishop must accept the priest.