Is it safe to get a belly button piercing?

It can be safe.

A "safe" piercing comes from going to a reputable shop (skilled piercing artists, clean studio, clean needles, clean and safe jewelry) and performing proper aftercare (which any reputable shop will inform you of).

An "unsafe" piercing comes from getting it done anywhere that isn't a reputable shop. This means using hypodermic needles from farm supply stores, using safety pins, the person performing the piercing has no formal training, the person performing the piercing doesn't have a sterile room for the work to be done at, any equipment that isn't factory sealed and sterile. Generally you will not get proper aftercare information, nor treatment from a "garage piercer".

Though - an unsafe piercing can also come from yourself not taking proper aftercare measures, even if you get it done in a shop.