According to one of my books, "Virsuses, Plagues & History", by Michael B. A. Oldstone, the yellow flag began being used by the following reasons:
" As trade by ocean-going vessels continued, yellow fever struck Brazil in 1686, Marinique in 1690, Cadiz, Spain, in 1730, and later Marseilles, France, and the port of Swansea (1878) in Wales. Knowing that victims of yellow fever must be isolated from other patients and the general population, the staff of Greenwich Hospital of England dressed the segregated patients in jackets with yellow patches to forwarn others about the contagion. They were nicknamed "Yellow Jackets," and a yellow-colored flag that flew over the quarantined area was referred to as the "Yellow Jack."
I hope this helped you some. I will look thru some more of my books that I have concernng flags, quaratines etc.
Diseases of history are one of my main interests and specialities.