Prime Minister Imran Khan through an official notification of August 19 granted a three-year extension to General Bajwa, citing "regional security environment".
Bajwa's original tenure is set to expire on Thursday at midnight and he can continue as the army chief if the Supreme Court decides the case in his favour before that.
"There is still time. The government should step back and assess what it is doing," said Chief Justice Khosa, who is heading a three-member apex court bench comprising Justices Mazhar Alam Khan Miankhel and Syed Mansoor Ali Shah.
"They should not do something like this with a high-ranking officer," he said, referring to the extension of the army chief's tenure.
"You have turned the army chief into a shuttlecock," he told Attorney General Anwar Mansoor Khan, who presented arguments on behalf of the government.
Chief Justice Khosa said that new summary sent by the prime minister to the president was a request for reappointment of the army chief. But the president issued a notification for extension in his tenure.
"The government should clarify whether it wants to give an extension to army chief or wants to reappoint him," he said. "They never bothered to check what is written and what they are sending."
Khan attributed the gaffe to "clerical errors" by the law ministry, adding that the army chief is due to retire at midnight Thursday.
"Why do you make such errors?" asked the chief justice. "You should have the degrees of those people examined who are responsible for drafting these documents."
The proceedings were adjourned until Thursday.
The unprecedented action by the apex court shook the high echelon of powers as the government scrambled to control the damage.
Prime Minister Khan held an emergency Cabinet meeting to deal with the precarious situation, with Gen Bajwa himself attending the deliberations.
The case was expected to have widespread ramification for the country and its powerful army.
Farogh Naseem, who resigned from his post as law minister on Tuesday to pursue the case, represented Gen Bajwa in the court.
During the hearing, the attorney general said the process was "nothing new" and "extensions were notified in the same manner in the past."
Justice Alam responded, "In the past the court never stepped in to assess someone's extension in tenure."
The chief justice said the matter of the period of army chief's tenure is very important.
"In the past, five or six generals have granted themselves extensions. We will look at this matter closely so that this does not happen in the future. This is an extremely important matter [and] the Constitution is quiet about this," he said.
Gen Raheel Sharif is the only army chief to have retired on time in the past two decades.
"According to the law, during a war, the army chief can stop officers' retirements," Khosa said. "However, the government wants to stop the army chief's retirement."
Justice Shah pointed out that Article 243 of the Constitution talks about the appointment of an officer and asked: "Does it mention the period of appointment as well?"
He asked if a general can continue to work if his tenure is extended two days before his retirement.
"Where does it say that it is a three-year term (for an extension)?" he asked. The attorney general admitted that the period of the tenure is not specified in the rules.
Justice Khosa emphasised that the court was looking at the rules regarding the tenure of the army chief, not a general.
"If something is wrong as per the law, we cannot say that it is correct. If [the decision] is not correct as per the law, we will give our verdict," Khosa said.
Pakistan's powerful Army, which has ruled the country for more than half of its 70 plus years of existence, has wielded considerable power in deciding matters concerning security and foreign policies.
Chief Justice Khosa in an unprecedented move on Tuesday suspended the government's order citing legal lacunas. The petition against Gen Bajwa's extension was filed by a person named Raiz Rahi.
After the top court's order on Tuesday, the Cabinet amended Section 255 of the Army Rules and Regulations and included the words “extension in tenure" to meet the legal lacuna in the rule.
The Cabinet in its two sittings prepared a new summary for the extension and sent it to President Arif Alvi for approval. Prime Minister Khan and President Alvi approved a fresh notification.
The Army so far has not commented on the development.
Gen Bajwa is the second army chief to get full term extension in recent times. Earlier, Gen Ashfaq Pervaiz Kayani was given a full term in 2010.
Prime Minister Khan and Gen Bajwa have been working closely. Bajwa accompanied Khan on his maiden US visit during which he met US President Donald Trump at the White House.
Khan had also nominated Bajwa as a member of the National Development Council, in an unprecedented move.
When Bajwa was appointed army chief by former prime minister Nawaz Sharif, he superseded three generals.
Analysts say that regardless of the outcome, the action by the top court has rattled the Khan government and exposed its several weaknesses.
Opposition parties after a joint meeting on Tuesday slammed the government for inefficiency.