Unless you already know the language, taking a German course even before you arrive here is an excellent idea. The Goethe-Institut, for example, offers high-quality courses all around the world. You can also find numerous free alternatives online, such as from Deutsche Welle. Eventually, however, you will probably learn the most right here in Germany. Here, you will be surrounded by the language every day, which will give you plenty of chances to practice!