To sit on the fence means to not make a decision or take a side, and in this context they have been undecided about legalizing marijuana.
Consider the statement "They have been undecided and not taking any sides about legalizing marijuana for the past several years.". Is the statement "They have been sitting on the fence about legalizing marijuana for the past several years.”" false? Yes/no/unknown