Girl to give birth in harem becomes his legal wife