The standoff lasted until 6:40 a.m., when authorities blew a hole in the wall of the second-story apartment and found the two bodies, authorities said.
At least one of the two people was believed to have opened fire on officers hours earlier, police Lt. Andra Brown said.
It was not immediately clear whether the two people committed suicide or died during the shootout. The suspects were not immediately identified.
Authorities said Officer Christopher Wilson, a 17-year veteran of the department, died at a hospital.
The confrontation began about 10:45 p.m. Wednesday when federal probation officers and U.S. marshals went to the apartment in the Skyline area of southeast San Diego to check on a man who was on probation for assault with a deadly weapon, Brown said.
Someone inside opened the door then slammed it in the faces of the officers, Assistant Police Chief Jim Collins told the San Diego Union-Tribune.
The officers kicked in the door and took a man into custody then called San Diego police to help search the scene.
Dozens of San Diego police officers, deputies and federal officers responded and a special weapons team cordoned off the apartment and evacuated nearby buildings.
A man and woman were arrested about 3 a.m. after the SWAT team fired a flash-bang grenade inside, police said.
Police have not released further details about the shooting and it was unclear when Wilson was shot.
A man who only identified himself as Luis watched the siege from a grocery store parking lot across the street wearing a Red Cross blanket and bright blue socks. He told The Associated Press he was in a downstairs apartment with his wife and two small children when he heard gunfire.
"I just hear like a big boom, then they exchanged some words, then I heard 'Officer down! Officer down!,"' he said.
Luis said he rushed to his window and saw police carrying another officer with a blood-covered neck and face down the stairs.
He continued to hear gunshots and told his family to take cover. Moments later, an officer banged on the door and told them to get out. The family fled as shots rang in the darkness, Luis said.
Luis said he saw about 50 men, women and children running, crouched over, out of the complex. Some were in pajamas and slippers.
Luis said a couple lived in the upstairs apartment where he heard the noise, and he had seen a small girl there but he did not know if she also was a resident.
"They looked like really calm people," he said. "I never thought they would be like that."
A tenant, Ryan Davis, told the San Diego Union-Tribune that he heard six to 12 shots fired from what sounded like handguns and a shotgun.
During the shooting, two officers fled the apartment then went back inside to retrieve their wounded comrade, who died at about 3 a.m. Thursday at a hospital, Brown said.
A police dog named Monty also was wounded in the shooting but is expected to survive, Brown said.