Scan the grid. When you find a '1' that hasn't been visited, start a BFS (or DFS) to mark all connected land cells as visited.
Each time you start a new BFS, increment your island count. The BFS explores all cells of one island, marking them so you won't count them again.
You can mark visited cells by changing '1' to '0' or using a separate visited set.