In this paper, we propose a novel joint active and passive beamforming approach for integrated sensing and communication (ISAC) transmission with assistance of reconfigurable intelligent surfaces (RISs) to simultaneously detect a target and communicate with a communication user. We first show that the sensing and communication (S&C) performance can be jointly improved due to the capability of the RISs to control the ISAC channel. In particular, we show that RISs can favourably enhance both the channel gain and the coupling degree of S&C channels by modifying the underlying subspaces. In light of this, we develop a heuristic algorithm that expands and rotates the S&C subspaces that is able to attain significantly improved ISAC performance. To verify the effectiveness of the subspace rotation scheme, we further provide a benchmark scheme which maximizes the signal-to-noise ratio (SNR) at the sensing receiver while guaranteeing the SNR at the communication user. Finally, numerical simulations are provided to validate the proposed approaches.