Only if there exists probable cause that the person has committed a crime. They had none.
It was later adjudicated to allow a "stop and frisk" for weapons if the officer had reasonable suspicion that the person has committed, is committing, or is about to commit a crime and has a reasonable belief that the person may be armed and presently dangerous. But this was several years away, still. Terry v. Ohio, 392 U.S. 1 (1968)
However, they had no such reasonable suspicion towards a guy buying a coke in a second floor lunchroom.
A cop can ask anybody whatever questions they like. It's free speech. Just not detain, search, or arrest them.
I have no understanding at all about Texas laws in 1963 - and am unsure about US law at that time (pre-Terry) - but under current law there is no requirement of "probable cause" for the police to use in order to detain or question a person in exigent or emergency situations. That is the standard for so-called "Terry stops" and not for an emergency situation involving a crime in progress, which this was.
Again: emergencies.
The standard in
emergency situations is: "Those circumstances that would cause a reasonable person to believe that entry (or other relevant prompt action) was necessary to prevent physical harm to the officers or other persons, the destruction of relevant evidence, the escape of a suspect, or some other consequence improperly frustrating legitimate law enforcement efforts.' United States v. McConney, 728 F.2d 1195, 1199 (9th Cir.), cert. denied, 469 U.S. 824 (1984)."
Baker's situation, for me, clearly falls in the above circumstances since he did not know who Oswald was or what he was doing. As he said in his 11/22 affidavit: "As we reached the third or fourth floor I saw a man walking away from the stairway. I called to the man and he turned around and came back toward me."
Nothing about a man in the lunch roon buying a Coke. Who was this person? Was he a shooter? Was he an accomplice? Was he a lookout? It was certainly reasonable to me that this person could have been involved in some way (guess what? he was). Baker was investigating a situation in flux, a shooting in progress. How would he know who was part of that shooting and who wasn't? He couldn't, it was an emergency.
In fact, as we know, right after the shooting the DPD secured the entire building and detained every employee for questioning. Oswald would have been one of them had he not left earlier.