Dear voltaic,
in principle, getting married without a residence permit in Germany is possible and allowed.
As far as I understand it, however, several things must be taken into account if you want to get married in Germany:
- you will need a valid passport or identity card and a current certificate of registration.
- both you and your boyfriend must be over 18 years old;
- you have to be legally competent (this is at least the case when you are older than 18 and do not have a disease that excludes free will);
- there must be no marriage prohibition (this would be the case, for example, with an existing marriage or family relationship between the two persons who wish to marry each other);
- you need the birth certificate or a certified copy from the birth register or other proof of descent of both partners;
- if you or your partner were already married, you need a certified copy from the marriage register of the last marriage respectively the dissolution by a divorce decree or by a death certificate;
- you, as the the partner from abroad, need a certificate of marriageability from your country of origin. This certifies that there is no impediment to marriage under the law of that State, in particular that you are already married. This should ideally be written in English. You apply for a certificate of marriageability for foreigners at the competent home authority. You can usually contact the consulate responsible for you. At the latest when you register your marriage at the registry office, the registrar will point this out to you and tell you which documents are required. If there is no such thing in the country of origin, an application for exemption can be made to the competent Higher Regional Court.
It would be best if your boyfriend makes an appointment with the relevant registry office to find out what documents are required for you in order to get married.
The marriage is applied for at the registry office. Subsequently, the documents are checked. The marriage ceremony can only take place once all the documents required for the marriage have been submitted to the registry office.
Please note that the police will find out about your intentions to marry because the necessary documents include a certificate of registration from the registration office.
According to openly accessible sources on the internet, a deportation is usually only suspended when the marriage is imminent. This is only the case if you have obtained all papers. Furthermore, it will be checked whether it could be a "sham marriage", i.e. a marriage that is only concluded because you want to obtain a right of residence. You may have to undergo inspections of flats and interviews. If there are indications of a "sham marriage", no toleration will be granted.
I hope this answer is helpful.