We consider the class of weakly porous sets in Euclidean spaces. As our first main result we show that the distance weight w(x)=dist(x,E)−α belongs to the Muckenhoupt class A1, for some α>0, if and only if E⊂Rn is weakly porous. We also give a precise quantitative version of this characterization in terms of the so-called Muckenhoupt exponent of E. When E is weakly porous, we obtain a similar quantitative characterization of w∈Ap, for 1<p<∞, as well. At the end of the paper, we give an example of a set E⊂R which is not weakly porous but for which w∈Ap∖A1 for every 0<α<1 and 1<p<∞.