The victory guarantees their place in the semifinal and a place in the World Cup in Australia and New Zealand.
Morocco enjoyed home advantage as their passionate crowd chanted in support of the players at the Prince Moulay Abdallah Stadium which earned them an early goal after just three minutes of play.
Midfielder Fatima Tagnaout played in a shallow freekick that Sanaa Mssoudy provided a sliding touch to, steering the ball into the net to the delight of the supporters.
But the lead lasted all of seven minutes as Botswana swept in a freekick of their own with Keitumetse Dithebe hammering home a powerful left-footed effort from outside the area that proved too hot to handle for Morocco goalkeeper Khadija Er-Rmichi.
Botswana, competing at the first WAFCON, showed they were not fazed by the occasion although Morocco looked a little sharper before the break, with English-born striker Rosella Ayane sweeping an around-the-corner effort just wide one minute before halftime.
Mssoudy had her 49th-minute shot plucked out of the air by Botswana’s impressive goalkeeper Maitumelo Boseja while Morocco kept up the pressure as Sabah Seghir turned well to shoot but hit wide in the 54th minute.
Four minutes later, the hosts went back ahead as Tagnaout delivered a high ball to the back post to allow defender Yasmin Mrabet to score with a forceful downward header that crept past Boseja.
Mssoudy hit the woodwork with 15 minutes left with a shot from the edge of the area as Botswana looked to be wilting under the constant pressure from a Morocco side who looked much fitter.
It was Morocco’s fourth win at WAFCON, after a 100 percent run in the group phase, and they now meet either Cameroon or Nigeria in the semifinal next week.