DPI information is only relevant when the pixels are projected to a device that have defined metric dimensions, so you can measure the size of the projection of one sample (pixel).
Traditionally, computer screens have only a fictitious DPI scale, which is considered something like 72, 96 or 120 etc. dpi, as those are the most probable actual size of the monitors available on the market; and since operating systems usually don't know the metric scale of the actually attached destination screen, this DPI setting is kept as a user setting.
This fictious current DPI setting in OS is used to implement scaling of the font and user controls, or to implement a "display a printable document in actual size" function. But for displaying on a computer's screen, which has it's own intrinsic DPI as a raster device and at the same time can display content in different scale on user's demand, this setting in the image is irrelevant. The best rule in pre-retina era was - use the size in pixels which matched the screen's resolution. Oversampling did not provide any benefit, as a slightly scaled down image looked worse than perfectly fit to screen's resolution, event if it's effective DPI was higher.
But when you are working with a publishing software such as InDesign this setting, embedded in the images would allow you to size the placed image when editing the pages.
The same (in pixels) image with different DPI settings would occur at different scale when placed on a page initially, depending on the tool you use to place the image.
The same applies to word processing software, such as the Microsoft Word.
Actually, it could be used by any software having a concept of physical canvas size as well.
So, if you export with different DPI setting, you can find that it's obeyed by different software systems when initially placing the image on a canvas, or in a sort of "display in actual size" function.
Actually, I found this setting very useful, because it affects the imagery placed in InDesign when you are placing many images of the same size. In my case, tuning this setting alowed to create an image gallery almost automatically, instead of scaling each image individually.