Regarding whether secondhand smoking invalidate fasting or not, Dr. Hatem Al-Haj, a Professor of Fiqh said that, secondhand smoking doesn’t invalidate fasting.

It is very important that we avoid mingling with sinners to the best of our abilities while they are sinning. However, If we have to be in the presence of people who smoke, and we find it appropriate, given our relationship with them and the nature of the setting etc, We ought to advise them against smoking for the sake of their religion and their lives as well.