According to [1] and [2] it is used to distinguish movement or location.
Some paraphrased examples from [2]:
"Han gikk der" -> "He walked in that area" / "He walked around there"
"Han gikk dit" -> "He walked to that area/location" / "He went there"
And as far as I can tell, "der" & "dit" = "there", and "her" & "hit" = "here", so the same rules apply to "her" and "hit". But as is also said in [1], some dialects only use "der" and "her", and this is therefore accepted in spoken Norwegian.
1. http://www.diskusjon.no/index.php?showtopic=798832
2. http://www.riksmalsforbundet.no/Spr%C3%A5ktjenester/Spr%C3%A5kspalten/Ord-og-uttrykk-bruk--betydning-og-etymologi.aspx?PID=281&M=NewsV2&Action=1&NewsId=154