You may be able to obtain a patent for a method of using the compound to treat diabetes, so long as the method is novel and non-obvious. If the prior art does not describe using the compound (or another compound that one of ordinary skill in the art might expect to act similarly) to treat diabetes in any way, then the method might be as broad as any way of treating diabetes with the compound. Otherwise, you may have to narrow the method to a specific treatment protocol (e.g., administering X amount in Y manner). And it's possible that you still won't get the patent, depending on what prior art is out there already.
However, you would not be able to obtain a patent for the compound itself, nor for the mere fact that the compound can be used as a diabetes treatment—only for a method of exploiting that fact.