Indeed it can. Here are some simulated data with a squared relationship between the predictor and the response, and the fit from a Random Forest:
nn <- 1e4
xx <- runif(nn)
yy <- xx^2+rnorm(nn,0,0.1)
model <- randomForest(yy~xx)
xx_pred <- seq(0,1,by=.01)
As to how the RF does this: remember that it is just a collection of classification and regression trees. Each separate tree (based on a bootstrap sample of the data, and a subset of predictors) will use a different cutoff of the predictor and output a different value for the response for low vs. high predictor values. On average, the fitted reponse for high predictor values will deviate more from the average than for low predictor values, and thus model the nonlinear relationship.
There are also RF implementations that fit linear models on the predictor in the leaves. These can of course also model nonlinearities, by fitting different slopes for different values of the predictor.