This is useful to prevent downloaded voicemail files from playing between the songs in a playlist, and to keep personal photos private while still allowing those in other folders to be shared in person with friends, family, and colleagues. The .nomedia file has no effect on the filesystem or even the operating system, but instead depends entirely on each individual app to respect the presence of the different files.
The Android operating system uses empty .nomedia files to tell smartphone apps not to display or include the contents of the folder. This prevents digital photos and digital music files from being shown in picture galleries or played in MP3 player apps.