Yes, it is theoretically possible. (nuclear) bombs do not look at flags or landmarks, they don't know if they are exploding in a friendly territory or not. They are just given some coordinates, their computer follows the trajectory from the launch point until the target point and then, KABOOOM, they explode.
If somebody, accidentally or willingly, would insert the coordinate of a friendly location and nobody should realize the error until the explosion, the blast would surely happen.
(the same can happen if instead of giving the coordinates to a computer, one gives the coordinates to a plane carrying the bomb)
That's why there are several redundant security layers in such systems, to reduce the chances of human failures.