The Dutch Sunweb rider began Tuesday with a two minutes 41 seconds advantage but stopped temporarily 33km from the finish to deal with "stomach problems".
Controversially, the rest of the riders did not wait for him and carried on.
Italian Nibali's stage win takes him third in the overall standings, behind Dumoulin and Colombian Nairo Quintana.
The defending champion held off Team Sky's Mikel Landa in a sprint finish after escaping from Quintana during a high-speed final descent into Bormio.
Dumoulin said he was "very disappointed" and "very angry" immediately after the race, but later wrote on Twitter that he was not upset that the "other teams didn't really wait".
"A day to quickly forget! Good legs, but very disappointed that I lost two minutes because nature called," he added.
"It was not the moment or the time in the race anymore to come to a complete shutdown because nature called me."
Wednesday's stage 17 is a 219km race from Tirano to Canazei.
1. Vincenzo Nibali (Ita/Bahrain) 6hr 24min 22sec
2. Mikel Landa (Spa/Team Sky) same time
3. Nairo Quintana (Col/Movistar) +12secs
4. Domenico Pozzovivo (Ita/AG2R) +24secs
5. Ilnur Zakarin (Rus/Katusha) +32secs
6. Davide Formolo (Ita/Cannondale) +1min 26secs
7. Bauke Mollema (Ned/Trek) +1min 35secs
8. Bob Jungels (Lux/Quick_Step) same time
9. Adam Yates (GB/Orica)
10. Thibaut Pinot (Fra/FDJ)
1.  Tom Dumoulin (Ned/Sunweb) 70hrs 14mins 48secs
2.  Nairo Quintana (Col/Movistar) +31secs
3.  Vincenzo Nibali (Ita/Bahrain) +1min 12secs
4.  Thibaut Pinot (Fra/FDJ) +2mins 38secs
5.  Ilnur Zakarin (Rus/Katusha) +2mins 40secs
6.  Domenico Pozzovivo (Ita/AG2R) +3mins 05secs
7.  Bauke Mollema (Ned/Trek) +3mins 49secs
8.  Bob Jungels (Lux/Quick-Step) +4mins 35secs
9.  Steven Kruijswijk (Ned/LottoNL) +6mins 20secs
10. Adam Yates (GB/Orica) +7mins

The preliminary figures show that operating profit will be 6.1tn won ($5.1bn; Â£3.5bn) for the October to December period, from 5.29tn won a year earlier.
Analysts had expected the amount to be 6.6tn won, fuelling growth concerns.
Samsung products have been hit by weak demand in China and currency woes.
Operating profit fell 7.5% from the previous quarter.
Sales at the world's biggest maker of memory chips and smartphones also missed forecasts at 53tn won for the period.
Samsung does not break down its earnings results in the preliminary report, leaving analysts to speculate on how each business division is doing.
But analysts predict that the latest forecast is a sign that the tech giant will face another tough year of weaker gadget sales as the smartphone market is saturated.
Samsung is facing stiff competition at the top end of the market from Apple, while cheaper Chinese rivals are gaining ground in the mid to low level range for mobile devices.
On Monday, chief executive Kwon Oh-hyun had warned that the firm faced challenges on weak global economic growth prospects.
Final earnings results for the quarter are due to be released at the end of January.
Tom Dumoulin saw his overall Giro d'Italia lead cut to 31 seconds after an unscheduled toilet stop during stage 16, which was won by Vincenzo Nibali.
[NEXT_CONCEPT]
Samsung Electronics says its operating profit is likely to rise 15% in the fourth quarter from a year ago, missing market expectations.