If your partner is still abroad, he/she can apply for a visa for the purpose of marriage at the German embassy. This visa and the corresponding residence permit is valid for three months and can be extended by the Immigration Office for a further three months. Within these three to six months, your marriage should be officially registered. Otherwise, your partner may need to leave the country and apply for a visa again. In principle, your partner needs to present proof of a basic knowledge of the German language to obtain such a visa.
In case you and your partner have a child, if the paternity is acknowledged and you both share the child's custody, obtaining a residence permit is possible regardless of your marital status. You can learn more in our chapter “Born in Germany”.