After the crew of Deep Space 9 planned to collapse the Bajoran wormhole with a phase-conjugate graviton beam perfected by the Trill Science Ministry, the Bashir-Changeling sabotaged the station's emitter array. This allowed a Dominion fleet into the Alpha Quadrant and removed the threat of the wormhole ever being collapsed. The Changeling later attempted to destroy the Bajoran sun (in order to wipe out the combined Federation, Klingon, and Romulan fleets gathered to do battle with the Dominion) with an explosive device composing of trilithium, tekasite, and protomatter. He was killed before he could destroy the star when his stolen runabout, the USS Yukon, was intercepted by the USS Defiant. (DS9: "In Purgatory's Shadow", "By Inferno's Light")
Bashir had previously been impersonated by a Changeling who portrayed Krajensky in "The Adversary". In that episode, however, the real Bashir was missing for a matter of hours before his replacement was revealed to be a spy.
Based on the fact that the real Bashir was not wearing the newer uniforms introduced in "Rapture", we can deduce that he had been replaced by a Changeling since at least that episode. This means the Changeling performed surgery on Sisko in "Rapture" and tried to help save the Changeling infant in "The Begotten".
On the other hand, it is also possible that it was acceptable to wear either uniform style during that transitional period, as was seen in the transitional period Star Trek Generations, indicating that he may have been captured after the aforementioned events. However, that is unlikely since all Starfleet officers stationed on DS9 since "Rapture" have been wearing the newer uniforms.