When you upload media like images or documents to WordPress, it doesn’t just save the media, it also creates an attachment URL for it. A separate page for just displaying the media document so to say.
These attachment pages are quite empty and might not provide much information to your users. They contain the media item, and maybe a title if you entered one. Because of that, if you never use these attachment URLs, it’s better to disable them and redirect them to the media item itself.
Redirecting WordPress attachment pages using Yoast SEO
The easiest way to redirect WordPress attachment pages is to do it using a plugin like Yoast SEO.
Once you have installed the plugin then go to SEO->Search Appearance->Media, then set the Media & attachment URLs option to Yes.