For starters, one partner must be a resident in Germany. Whether they are a European national or an immigrant living in Germany with a visa, it does not matter.
The partner resident in Germany must contact his or her local registry office and ask for a list of necessary documents in order to conduct a marriage (e.g. translations of foreign-language documents). These lists may vary slightly depending on the registry office.