The navies of India and China carried out a joint operation on Sunday to rescue a merchant ship hijacked by Somali pirates in the Gulf of Aden, the Indian defence ministry said.