Yes, the foreground color you get is of type gimpcolor.RGB so you have to compare it with another object of the same type, so instead of using a plain tuple, you just create an instance of gimpcolor.RGB with the proper values. Note that gimpcolor is a separate module so you have to import it:
import gimpcolor
if (gimp.get_foreground() == gimpcolor.RGB(0,0,0,255):
Two remarks:
1) like in many other places, the gimpcolor.RGB contructor takes either floating point in the [0.-1.] range or integer in the [0-255] range (but with Gimp 2.9/2.10 it will make more sense to use the floating point values).
So the code above could be written, with the same results:
import gimpcolor
if (gimp.get_foreground() == gimpcolor.RGB(0.,0.,0.,1.):
2) you can avoid importing the gimpcolor module. In an object there is always a __class__ attribute to refer to the object's class, and this class can be used to call the constructor, so you can avoid the explicit import and use
fg=gimp.get_foreground()
if fg==fg.__class__(0,0,0,255):