Computer devices are frustrating sometimes, but the answer is usually pretty simple after it's all figured out.
If I read everything correctly, you have two devices.....one older iPad and one newer iPad. You are trying to reset the older iPad to give to someone else. Both devices are synced together right now. You keep getting a prompt to enter a restrictions code, but don't have it. Okay, I think I got it all.
So if I'm not mistaken, the restriction code is used to restrict uses of different apps or time spent on an app or to block a user from accessing adult websites. I believe it's a four digit code. In the older iOS versions, Restrictions had it's own tab under the General settings. In the newer iOS versions, it was incorporated into the Screen Time setting.
Now if your iPads are synced, then a restriction code on either device may work on both devices. You mentioned not knowing or ever having a restriction code. If that's the case, then I don't know how you would ever turn it off. Maybe another person in the family had entered one at some point. Can you still access all the settings on the old iPad to see if Restrictions is turned on?
If you have put any restrictions on anything using Screen Time in your new iPad, maybe those need to be reversed before you can reset the old iPad. I don't know off hand if Screen Time uses a code or not. I'm sorry I may not be much help, but sometimes talking it through may trigger a step that was missed.