It all traces back to Amazing Spider-Man Vol. 1 #11. In that issue,
Betty was coerced by a mobster named Blackie Gaxton into picking up Dr. Octopus upon his release from prison, as Gaxton had leverage over her brother, Bennett Brant.
BLACKIE GAXTON: Well, Brant? Did your sister do as I told her? I hope so, mister, for your sake!
BENNETT BRANT: Don't worry, Blackie! She's probably driving Dr. Octopus back to Philly right now! Betty wouldn't let me down!
BLACKIE GAXTON: She better not! That gambling debt you owe me is already past due! And you know what my boys do to welchers... don't you, Brant?
BENNETT BRANT: I know, Blackie! I've been your lawyer too long not to know!
BLACKIE GAXTON: I'll cancel the dough you owe me as soon as Dr. Octopus springs me from jail! And no sooner! Now get lost... I've got some thinkin' to do!
Amazing Spider-Man Vol. 1 #11 (April, 1964)
Later in the issue, Spider-Man came to Betty's rescue, and Ock apparently took note of that, as he decided to kidnap her from the Daily Bugle in the very next issue, figuring that since Spidey risked his life to save her once before, he'd likely do so again.
DOCTOR OCTOPUS: Good! Now that I know she is back working for the Daily Bugle, I'll be able to use her as bait to catch Spider-Man! He risked his life to help her once before... so why not again?
DOCTOR OCTOPUS: Now listen -- no one will be hurt if you do as I say! Jameson, put a note in your paper telling Spider-Man to contact you! When he does, tell him I have the girl prisoner at Coney Island! If he wants her -- he must come for her -- alone!
Amazing Spider-Man Vol. 1 #12 (May, 1964)
So the subsequent kidnapping of Betty in Amazing Spider-Man Annual Vol. 1 #1 was based on the same line of reasoning. Aunt May was grabbed too, purely because she happened to be with Betty when Sandman and Electro came for her. It was made clear that neither Sandman nor Ock actually knew who May was.
SANDMAN: There's that Brant girl now! But who's that with her?
ELECTRO: What's the difference?! We'll take them both if we have to! Let's go!
[...]
DOCTOR OCTOPUS: Ah, Miss Brant! Come in! I've been expecting you! And who is that charming lady with you?
SANDMAN: She says she's the aunt of some kid named Peter Parker, Doc!
Amazing Spider-Man Annual Vol. 1 #1 (October, 1964)
Ock actually unmasked Spider-Man in Amazing Spider-Man Vol. 1 #12, the last issue they fought in prior to Amazing Spider-Man Annual Vol. 1 #1. However, Spider-Man was defeated so easily in that instance, due to being severely weakened by the flu, that Ock assumed Peter must have been pretending to be Spider-Man in a desperate ploy to save Betty.
DOCTOR OCTOPUS: He's almost unconscious!! I can't believe it!! He doesn't even struggle as I try to remove his mask! There can only be one answer... I should have known!! It isn't Spider-Man! It's that weakling brat, Peter Parker!
DOCTOR OCTOPUS: Bah!! Take your puny hero! He's of no interest to me! It's the real Spider-Man I'm after!!
Amazing Spider-Man Vol. 1 #12 (May, 1964)
Ock didn't realise that Peter genuinely was Spider-Man until he unmasked him for a second time during the "Clone Saga" storyline in the 1990s.
DOCTOR OCTOPUS: I remember unmasking a considerably younger Peter Parker many years ago. For reasons which I now forget, I refused to believe that you were truly Spider-Man! It's almost funny how easily reality can be manipulated to assume any appearance.
Spectacular Spider-Man Vol. 1 #220 (January, 1995)