The explosive right-hander, who was recently promoted to the opening slot, was in discomfort during England’s narrow six-run win over South Africa yesterday.
The England Cricket Board had earlier announced that Pietersen would undergo a hernia surgery after the team’s World Cup campaign but the operation has been advanced now, a team spokesman said.
The ECB has asked for Eoin Morgan as a replacement player for Pietersen.
Pietersen’s injury first came to light after the 1-6 ODI series loss to Australia before the World Cup.
Having the surgery after the World Cup, which ends on April 2, would have ruled him out of the Indian Premier League, starting just six days after the mega event.
But advancing the procedure could see him turn up for his franchise Royal Challengers Bangalore in the Twenty20 league.
His replacement Morgan would be coming in after nursing a finger injury but given that he is a middle-order batsman, Jonathan Trott or Ian Bell could be promoted to the opening slot to partner skipper Andrew Strauss.
England have endured a roller-coaster World Cup so far, beating the Netherlands, tying a thriller against India, losing to minnows Ireland before getting the better of South Africa in another humdinger.
They will now travel to Chittagong to face co-hosts Bangladesh on Friday.
Pietersen confirmed that he is out of the World Cup on his twitter page.
“Confirming the BREAKING NEWS mate: I fly home tonight.
Out of the WC & IPL. Absolutely devastated!!” he wrote.
“Sad to leave India. Love the people & the hospitality!! Alvida doston…not a lot u can do about injuries mate!! onwards & upwards,” he added.