Here is a pic from my textbook, Adwell/Schachter's Tonal Harmony. It tells me what the soprano should be in the figured bass but there is a 2 next to both notes. What does that mean?


These numbers indicate what we call octave designation, which these authors discuss in their chapter on key/scale/modes (depending on what edition of the book you have, these chapters may be separated).
With that said, the system they're using treats Middle C as C1. This means that Middle C is C1, the C an octave above that (the third space in treble clef) is C2, etc. Everything between C1 and C2 is labelled as a 1, everything between C2 and C3 (the C above the treble clef) is labelled as a 2, etc.
Thus the annotation here is telling you that your soprano pitch, D♭2, will be the fourth line of the treble clef, because it's the one within the C2 octave. In the next chord, that soprano will move up a major third to the nearby F2.
I've discussed octave designation in my answer to How do you refer to a note that is more than one octave above or below middle C?, but you'll notice that this specific system isn't in my answer. That's because this system is a variant of the Helmholtz system at the bottom of my answer, but one that uses Arabic numerals instead of hash marks.