If efficiency is not an issue and a simple solution is OK, you could consider the following pseudo-code:
visited = new bool[N,M]
points = new List<Point>()
prev = new List<int>()
points.Add(Begin)
prev.Add(-1)
visited[Begin.X, Begin.Y] = true
for(i = 0; i < points.Length; i++)
p = points(i)
foreach neighbor of p
if neighbor is not wall && !visited[neighbor.X, neighbor.Y]
points.Add(neighbor)
prev.Add(i)
visited[neighbor.X, neighbor.Y] = true
if neighbor == End
// we are done, print path (without Begin and End)
j = i
while j != 0
print points[j]
j = prev[j]
return
// no solution found
(It is just a modification of Flood fill algorithm, http://en.wikipedia.org/wiki/Flood_fill.)