"queer" is usually properly defined as strange or unusual, "gay" as happy or merry, and both had become slang for homosexual by the mid-20th century (OED's first reference to that slang usage of "queer" in the US is from 1914, well before Asimov's writing). Slang usages overlap with non-slang usage, so if Asimov used the word "queer" he could have been using either definition.
Slang words for culturally taboo topics like sexuality generally rely on that ambiguity because it allows people to circumvent the taboo, and so that discussion of sexuality could be plausibly denied if challenged. You see a similar thing happening today in socially conservative circles, discussing a family member's "roommate".
With all that said, "queer" was a much more socially acceptable slur for gay folks back in the 40's, and I thought that's what you meant. Asimov might well have used "queer" to mean strange or peculiar, I'm working with a paper copy so I can't easily search for usages, but I think the word itself pops up a couple of times with that meaning.
I don't think the use of "fag" as synonym of cigarette ever really caught on in the US, and I don't think I've seen it in Foundation, so you may be remembering some other work.