Keiko was not in Starfleet at all, but that would not prevent her from being on the Enterprise, as there were children there as well. Being married to Miles O'brien likely entitled her to be there.
-She was there before she was married to O'Brien. There are many civilians on board Galaxy class starships. Keiko was the ship's botanist.
-Shouldn't the ship's botanist have been an officer just like a stellar cartographer or a geologist or any of the other number of scientist position's we've seen filled by officers?
Okay, she was a civilian botanist with research experience and interests that coincided with what they needed aboard the Enterprise-D.