It's not entirely certain that endometriosis is caused by metaplasia. It might be that the cells literally migrate and fasten themselves to other areas.
However, one of the leading theories is that it is caused by coelomic metaplasia. What that means is that coelomic cells (which are basically part of your torso when you are developing in the womb) can become both kinds of cells involved in endometriosis.
So, the theory goes that sometimes they get mixed up and change later on in life, possibly because of an infection or inflammation.
They are still researching endometriosis, which is fantastic, because it's only recently that doctors even admitted it exists.