As others have said, it's important to read proofs in detail in the material you're studying.
Also, you need to write your own proofs. Ideally, you would obtain feedback from a competent teacher on everything you wrote. Since this usually isn't feasible in practice, the next best thing is a problem book with detailed solutions. Write your own solution to a problem, and then compare it with the book's solution. Of course, it is often possible to write a solution that is completely different from the book's, but is equally correct. Nonetheless, the process of comparing your solution with the book's frequently reveals major errors in your own proof, points at which you've left out an important argument, or details which you ought to have mentioned but didn't.
Often a problem arises when a student moves from primarily computational math courses to ones in which proofs are unavoidable, such as analysis or abstract algebra. In this situation, one difficulty in learning proofs can be that you are fighting a battle on two fronts at once: (1) learning how to write proofs; (2) learning material that involves many new concepts, and that may be difficult in its own right.
For some students, this isn't a big problem, but for most, it helps to gain experience with proofs first in the context of familiar objects and concepts, such as whole numbers, inequalities, geometry, etc. There are a couple of resources that can help in this case:
(1) Books with proofs that are targeted at high school students, such as those in the MAA's Anneli Lax New Mathematical Library. For people who can read Russian, the website math.ru has many free books on elementary subjects (mostly published works that can legally be freely distributed).
(2) A well-written "transition to higher mathematics" textbook. The best one I know of is Rotman's Journey into Mathematics. The material in it is both interesting and elementary, and it has a detailed solutions manual available for free. Unless your tastes lead you to them, I would avoid books of this category that focus primarily on the formal foundations of mathematics, such as logic and sets. While these are important, it's usually better to learn about them in the context of studying material you find interesting anyway. (Studying logic and set theory in depth is usually much more fruitful if you return to them once you've learned, through practice, how to adopt a mathematical mindset.)