By 1940 there WERE no civilians in Nazi Germany.
Everybody was considered a "soldier".
Any weapons produced were military, other than a tiny handful produced for foreign governments.
I believe Germany produced commercial-marked HP/P-38 pistols for Sweden? during the war.
A pistol marked like yours was strictly for issue to German police and military forces, and as such was undoubtedly issued to and used by a Germany soldier or police officer.
NO civilian other than Party members or other "important" people were even allowed to possess firearms, much less military firearms.