To enforce DRM in streaming apps, mostly; though other apps have ended up bodging that for their own purposes.
I suppose at least in the context of secure messaging or banking apps (which also do this) it makes you think twice before snapping something, but even so I think there should be a variant of whatever API which lets the user override it / disable it globally.
Only genuine security concern I can think of that it addresses is that of screen recording malware / stalkerware (assuming said malware doesn't already have root access on your device to circumvent it...), and perhaps the risk of accidentally screenshotting/capturing something sensitive like bank details while screen sharing.