The International Cricket Council made the move after Hindu nationalists Shiv Sena stormed the Board of Control for Cricket in India offices in Mumbai.
Dar umpired the first three and was scheduled to officiate in all five.
But Shiv Sena party activists threatened to stop Pakistani Dar from standing in the fifth ODI on Sunday.
Shiv Sena blames Pakistan for militant attacks in India and is opposed to any engagement with it.
Dar is a three-time winner of the ICC's Umpire of the Year award.
His replacement Ravi, a member of the elite panel of ICC umpires, had been selected for the series between Pakistan and England but will now stand in the fourth ODI between India and South Africa in Chennai on Thursday.
"Because of exceptional circumstances, both the BCCI and Cricket South Africa have agreed that two Indian umpires will stand in this game," said an ICC statement.
A meeting between India and Pakistan's cricket board chiefs at the Wankhede Stadium was cancelled after the protests.
BCCI chief Shashank Manohar was scheduled to meet his Pakistani counterpart Shahryar Khan to discuss India's participation in Pakistan's home series in December.
Indian umpire Sundaram Ravi has been named as Aleem Dar's replacement for the remainder of the one-day series between India and South Africa.