Context would really help here, but basically, a "Jack-in-the-box" is a toy which is a box with a lid and a little figure inside. You wind up the box, with music playing as you do so. At some point, the lid slams open and the figure - usually a clown - pops out. It's meant to surprise. So the expression is meant to compare something to that, something that just "pops out suddenly" and surprises you.