It was a fancy way of saying to the people who let those prisoners escape, "How could you be so stupid?" Stupidity used not, however, to be the main thing about naivety, which was more to do with artlessness, a different matter. Robert's French dictionary gives as its first definition of un naif someone qui a sa pensee sans detours, franche, directe, in fact an altogether admirable sort of person. That was its meaning when the French took it from the Latin nativus, carelessly losing a "t" on the way. And the principal meaning of nativus was "natural, not artificial" which was still what it meant when the English borrowed it from the French in the 17th century. It was a vogue word, always in italics, among the poseurs of Dryden's Marriage a la Mode. Hume used it with apologies for not being able to think of an English equivalent.
I guess that it was only gradually that it began, in both languages, to imply gullibility rather than simplicity; but its pristine meaning long predominated. Meanwhile there's no problem about what is meant by it. The attendant adverb tells you. When a critic complained in 1910 that the Douanier Rousseau's work (the artlessness of whose art had brought fresh air into the salons) was "intolerably naive", the Douanier replied that he had hung on to his naivety because better critics had encouraged him. No doubt they called him charmingly naive. The right kind of naivety is delightful. The wrong kind incredible. It's as simple as that.