Foreign students who want to apply for acceptance at a German university need, like the German applicants, a Certificate of Qualification for higher education (Hochschulzugangsberechtigung).
If the secondary school degree from your native country is comparable to the German Abitur you have direct access to higher education.
If you can only study certain subjects in your country due to the school degree, then this is also the case in Germany.
How your previous education is classified can be determined here: http://anabin.kmk.org/anabin-datenbank.html
If your Certificate of Qualification for higher education is not comparable to a German Abitur, then you must pass an assessment test (Feststellungsprüfung) to be able to apply for the desired subjects. You will be prepared for this test through a one-year course at the Studienkolleg.
If you have to take an assessment test, please inform yourself about the further proceedings here.