What does the “they” stand for here?

Solution 1:

It's bad grammar. In point of fact, they must, as you say refer to very few people, which gives a strained but just about comprehensible sentence. What the author evidently intended, however, is people or many people. Probably the best wording would be to leave they as it is, and replace very few people with people rarely.

Solution 2:

In the early days, very few people interacted directly with database systems, although without realizing it they interacted with databases indirectly — through printed reports such as credit card statements, or through agents such as bank tellers and airline reservation agents.

'they' is talking about the very few 'people'. While I know 'very few people' is the phrase, but directly, it is still 'people'.

As for it not making any sense, I agree with others that it is bad grammar. However, what they are saying is, is that these people 'in the early days', directly interacted with database systems although indirectly were working with databases through other mediums. These other mediums were the

'printed reports such as credit card statements, or through agents such as bank tellers and airline reservation agents'

And those mediums (I'm repeating just to stress) were why it was considered 'indirectly'.

Hope this clears things up for you!

Solution 3:

'They' in that sentence refers to 'people', not 'very few people'.

Please see below a more detailed answer.