Only certain denominations of Christianity allow pastors to get married while they are members of the clergy. There are a number of other denominations that allow married men to become pastors, but not to marry while active as pastors.
A pastor can marry while active as clergy in certain denominations of Christianity such as Anglicanism, Protestantism, Lutheranism and Presbyterianism. These pastors marry and have children while remaining active leaders in their churches.
Catholic priests, often referred to as pastors, are not permitted to marry while in the priesthood. There are some exceptions, however, such as when an Anglican priest who is already married, converts to Catholicism. Typically, however, Catholic priests take a vow of celibacy and are, in turn, 'married' to the Catholic Church.