More than one way, the most basic
With the layer active, Layer -> Mask > Show Layer Mask toggles the layer mask as a monochrome image. Save that as a png. You can toggle the show layer mask back off. There is a green border indicator on the layer mask icon.
example: https://i.imgur.com/isqnSCg.mp4
Putting it back in. Make a layer mask and click in the layer mask icon to make it active (white border) Open the layer mask image that was saved. Then Edit -> Copy (or ctrl-c) Go to the image with the layer mask, Edit -> Paste (or ctrl-v) That gets a floating selected layer, anchor the layer `Layer -> Anchor Layer (or (ctrl-h)
example: https://i.imgur.com/MidNcG5.mp4
Probably more trouble than it is worth. Most likely the next step is messing about scaling / positioning the layer mask to make it fit
With the layer active, Layer -> Mask > Show Layer Mask toggles the layer mask as a monochrome image. Save that as a png. You can toggle the show layer mask back off. There is a green border indicator on the layer mask icon.
example: https://i.imgur.com/isqnSCg.mp4
Putting it back in. Make a layer mask and click in the layer mask icon to make it active (white border) Open the layer mask image that was saved. Then Edit -> Copy (or ctrl-c) Go to the image with the layer mask, Edit -> Paste (or ctrl-v) That gets a floating selected layer, anchor the layer `Layer -> Anchor Layer (or (ctrl-h)
example: https://i.imgur.com/MidNcG5.mp4
Probably more trouble than it is worth. Most likely the next step is messing about scaling / positioning the layer mask to make it fit