What is XQuartz?
XQuartz is the continuation to Apple's deprecated X11.app which used to be part of OS X:
X11 is no longer included with OS X, but X11 server and client libraries for OS X are available from the XQuartz project: http://xquartz.macosforge.org. You should use the latest available version of XQuartz.
Source: About X11 for Mac - Apple Support
X11 is a very old windowing system for Unix that is not required for almost anything that you'll do on your Mac. The only widespread use of X11 that I use it for is Wine which allows you to run Windows software on your Mac.
XQuartz is very similar to X11, but is a 'community effort to further develop' X11:
Apple created the XQuartz project as a community effort to further develop and support X11 on OS X. The XQuartz project was originally based on the version of X11 included in Mac OS X v10.5. There have been multiple releases of XQuartz with fixes, support for new OS X features, and additional refinements to the X11 experience. Apple is a contributor to the XQuartz project and has worked to ensure that X11 works as expected in OS X with the latest available versions of XQuartz.
XQuartz doesn't 'mess up' the Retina display. It doesn't replace any of OS X's window management. $DISPLAY is only used with and for XQuartz as far as I am aware.