First of all, Peter is an apostle and is addressing Jews familiar with John's baptism during apostolic times (four separate, critical facts which do not obtain to most of us today). John was the Messiah's herald and Peter's audience needed to be appraised of Jesus' Messiahship; for those people of that generation in that time, water-baptism was the ritual which connected the Law to the One who fulfilled the Law. In short, this was the moment of transition so that it is not surprising that Peter is given to make use of transitional methods; but just as there are no more apostles and we now understand Christ's fulfillment of the Law, there is no further need of such devices (in fact, they are harmful, because just as continued sacrifice proclaims that Jesus' work was not good enough, so continued water-baptism, the ritual of anticipation of the Messiah, proclaims that He is yet to come). Secondly, this is not a command given to the Church but a historical account of Peter's actual words on the day of Pentecost. It thus does not have the force of a scriptural mandate (this is a common mistake people make with the book of Acts). Third, Peter does not actually command these hearers directly: he uses the third person imperative, not the second, that is, he uses an exhortation rather than a direct command (although he certainly could have phrased it the other way). Fourth, the direct command here is "repent", and it is that imperative which should be connected with "for the forgiveness of sins" (i.e., salvation is dependent upon faith whose necessary prerequisite is the understanding of the need to express faith: repentance). Fifth, the reason for the water-baptism is not salvation but the reception of the Spirit, a part of the quotation usually overlooked by advocates of water-baptism: "and you will receive the gift of the Holy Spirit". During the very early part of the apostolic times, the Spirit was initially given only through the laying on of the hands of the apostles. This was so that their authority in the Church might be properly established (cf. the Samaritan believers in Acts 8). Later, once this has been satisfactorily accomplished, the Spirit was given automatically (Acts 10), with the result that by the writing of Romans Paul can say that every Christian has the Spirit (Rom.8:9). The temporary and transitional continuation of water-baptism under the apostles is thus intimately connected with the mediation of the Spirit in early apostolic days; later, Paul would complain that the negative side-effects of the ritual out-weighed any good it did (indicating that it should have lapsed when all believers began to receive the Spirit without mediation: 1Cor.1:17). By the writing of Ephesians 4:5, there is only "one baptism", the baptism of the Spirit.
Jesus is very clearly referring to Spirit baptism and not to water-baptism as anyone who spends a few short minutes of careful investigation can easily ...