Leaving an order to become secularised (i.e. a diocesan priest) isn’t all that difficult; leaving one order to join another is much more difficult.
Normally, a religious priest who discerns for the gravest of reasons that his future may lie outside of the order will undertake a period of absence from the order allowing him to continue to function as a priest but separate from the order. The technical term is “exclaustration” (i.e. outside of the cloister) even though most orders aren’t cloistered! This will typically involve an agreement between himn/his order/the local diocesan bishop covering things like wearing of his habit (or not as the case may be), housing, health care and remuneration. It will also be for a fixed period, after which time he will decide whether to apply to be incardinated (or accepted) into the diocese - requiring what’s called an indult of departure: in other words, formal permission releasing him from his vows and membership in the order. At the risk of stating the obvious, he also needs a diocesan bishop who’s willing to take him on - something which should of course be worked out well in advance!
When it comes to leaving one order for another, the approval of both orders is required and the priest basically starts again - trial period, novitiate, temporary vows, final vows.