We prove a sharp lower bound for the maximum curvature of a closed curve in a complete, simply connected Riemannian manifold of sectional curvature at most zero or one. When the bound is attained, we get the rigidity result. The proof utilizes the maximum principle for a suitable two-point function. In the same spirit, we also obtain a lower bound for the maximum curvature of a curve in the same ambient manifolds which has the same endpoints with a fixed geodesic segment and has a prescribed contact angle. As a corollary, the latter result applies to a curve with free boundary in geodesic balls of Euclidean space and hemisphere.