James Madison was a federalist leader. The need for a Bill of Rights did not convince him. He thought that governments were capable of securing freedoms without the need for a federal mandate imposed. He was worried about the problems that a document, that at first seemed unnecessary, could cause, and so he tried to appeal to the anti-federalists to give up this effort to write it.
But the debate grew tension between federalists and anti-federalists as well. Madison thought that suppressing a Bill of Rights from the Constitution could lead the anti-federalists to abandon the drafting effort altogether, and when he saw that his goal of building a form of self-government was in danger, he put aside the disagreements he had with the anti-federalists.
Madison thus becomes an advocate of the Bill of Rights, arguing that he would not only educate people about their rights, but would also be a vehicle to protect them from future oppressive governments.