The German's established colonies in China, Samoa, New Guinea and other areas in the period of 1880-1900 and had already been trading in the area since at least 1850's as well as conducting the Eulenberg Expedition in the early 1860's: http://en.wikipedia.org/wiki/Eulenburg_Expedition
In the larger historical perspective, the 1870s and 1880s were pretty much the peak of western colonialism around the world, and even though German New Guinea (the earliest German Colony in the Pacific) was not established until approved by Bismarck around 1884, you can be sure that each country was doing it's best to keep tabs on what, and where, the other colonial powers were doing.
Germany was also very involved with Japan in this period of modernization: http://en.wikipedia.org/wiki/Germany%E2%80%93Japan_relations#Modernization_of_Japan_and_educational_exchange_.281871_to_1885.29
It seems reasonable to me that Darwin, Autralia may have laid 'near enough' the route of a German ship navigating it's way across the Indonesian Archipelago, for a ship blown off-course, or a Captain aiming to keep sight of land as much as possible, to have passed by. Alternatively, the ship could have been provisioning or doing repairs. Why, specifically, a military ship would have been in the area in the first place? Any number of tasks and roles come to mind... transporting and/or protecting dignataries and passenger ships, taking surveys and soundings, protecting trade ships from both pirates and other colonial powers.