Your intention is verily important. What was your intention while drinking water? Did you say that it was already broken so I can drink and eat?
Al-Bukhaari (6669) and Muslim (1155) narrated that Abu Hurayrah (may
ALLAH(s.w.t.) be pleased with him) said: The Prophet (peace and blessings of
ALLAH(s.w.t.) be upon him) said: “Whoever forgets he is fasting and eats or
drinks, let him complete his fast for it is ALLAH(s.w.t.) Who has fed him and
given him to drink.”
We can infer from your circumstance that you was still fast even though forgetfully swallow soap until drinking water. So, your intention is major factor. What did you think before/during drinking water? However, if you have a problem related to your health, you aren't forced to be fast. By doing this, you are tyrannising yourself. ALLAH(s.w.t.) doesn't love oppressors.
Consequently, ask yourself and your conscience because it says best fatwaa about your case.