It isn’t a stupid question. It is asked many times, because it is a commonly used contraction of “if (it’s) necessary, do this” or “if (it’s) possible, avoid it”. You can include "it's" or "it is" but you don't need to.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.