Medium access control (MAC) determines how sensor nodes share the channel for packet exchanging. To obtain the maximum network efficiency for accomplishing a specific task, the network has to adapt its parameters accordingly. In other words, different MAC protocols are required for different tasks. Localization is a crucial task of an underwater acoustic sensor network (UASN) which requires multiple packet exchanges. This article concerns the problem of designing a MAC protocol for a UASN which efficiently schedules the localization packets of the anchors. Knowing the relative positions of the anchors and their maximum transmission range, the scheduling protocol takes advantage of the long propagation delay of underwater communications to minimize the duration of the localization task. First, we formulate the concept of collision-free packet transmission for localization, and we show how the optimum solution can be obtained. Furthermore, we model the problem as a mixed integer linear program both in single-channel and multi-channel scenarios. Then, we propose two low-complexity algorithms, and through comprehensive simulations we compare their performances with the optimal solution as well as with other existing methods. Numerical results show that the proposed algorithms perform near optimum and better than alternative solutions.