Let (X, d, μ) be a metric measure space satisfying a Q-doubling condition (Q > 1) and an L2-Poincaré inequality. Let $${\cal L} = {\cal L} + V$$ be a Schrödinger operator on X, where $${\cal L}$$ is a non-negative operator generalized by a Dirichlet form, and V is a non-negative Muckenhoupt weight that satisfies a reverse Hölder condition RHq for some q ⩾ (Q + 1)/2. We show that a solution to $$({\cal L} - \partial _t^2)u = 0$$ on X × ℝ+ satisfies the Carleson condition $$\mathop {{\rm{sub}}}\limits_{B({x_B},{r_B})} {1 \over {\mu (B({x_B},{r_B}))}}\int_0^{{r_B}} {\int_{B({x_B},{r_B})} {{{\left| {t\nabla u(x,t)} \right|}^2}{{d\mu dt} \over t} < \infty } } $$ if and only if u can be represented as the Poisson integral of the Schrödinger operator ℒ with the trace in the BMO (bounded mean oscillation) space associated with ℒ.