We consider subdiffusion in a system which consists of two media separated by a thin membrane. The subdiffusion parameters may be different in each of the medium. Using the new method presented in this paper we derive the probabilities (the Green's functions) describing a particle's random walk in the system. Within this method we firstly consider the particle's random walk in a system with both discrete time and space variables in which a particle can vanish due to reactions with constant probabilities R1 and R2 defined separately for each medium. Then, we move from discrete to continuous variables. The reactions included in the model play a supporting role. We link the reaction probabilities with the other subdiffusion parameters which characterize the media by means of the formulae presented in this paper. Calculating the generating functions for the difference equations describing the random walk in the composite membrane system with reactions, which depend explicitly on R1 and R2, we are able to correctly incorporate the subdiffusion parameters of both the media into the Green's functions. Finally, placing R1 = R2 = 0 into the obtained functions we get the Green's functions for the composite membrane system without any reactions. From the obtained Green's functions, we derive the boundary conditions at the thin membrane. One of the boundary conditions contains the Riemann-Liouville fractional time derivatives, which show that the additional 'memory effect' is created by a discontinuoity of the system. The second boundary condition demands continuity of a flux at the membrane. keywords: subdiffusion, diffusion in composite systems with a thin membrane, random walk model