If you need to provide a Social Security Number, e.g. to your university or employer, then it depends on your type of insurance partner as to how you will receive this number. When you are insured with a governmental health insurance company, you do not need to worry. The social security will automatically be created in this case. If you need to provide the number in itself, you can contact your provider and they will send it to you. However, in case you are privately health insured, this number is not automatically created. In this case, you have to contact the Deutsche Rentenversicherung (German Pension Insurance) directly and request it from them.
It is possible to visit a branch of the Deutsche Rentenversicherung directly and request the number. Especially when living in bigger cities it should be rather simple finding a branch. People living in smaller cities might encounter more difficulties. Alternatively, you can also contact them directly online and request the social security number that way. In either of the two cases, please make sure to provide your passport, or a picture of it, together with your city registration (Meldebesätitgung) in your request.
You can find the Website of the Deutsche Rentenversicherung here: https://www.deutsche-rentenversicherung.de/DRV/EN/Home/home_node.html