You probably need to add a sigil at least, as in $DOCUMENT_URI. I'm not sure, but you may also need to use a question mark as in
<!--#include virtual="/cgi-bin/foo.cgi?$DOCUMENT_URI" -->
(Note that this places the string in @ARGV, not $ENV{QUERY_STRING}.)