Change non-diagonal surrounding elements in a 2-D array
Copying the array
You are over-complicating the array copy.  Array.clone will copy the objects of the array (but not the object's objects).  Using it on array of objects might be problematical, but an array of ints will be fine.
new = a.map(&amp;:clone)  # clone each row, return as an array

This line also removes the need of cleaning up your nils at the end
Additional Thoughts
While the logic is largely fine, stylistically your loops could be a little more idiomatic.
Unless you are using older ruby, you should tend to prefer .each.with_index over each_with_index.  They do the same thing but .with_index is a little more functional (programming).
Secondly, in general, try to chose better variable names than m, n, x, y.  You have comments describing what they are, but with better variable names, the code becomes self documenting.  (I've used ix_row and ix_col, but that's my personal naming convention for indexes; feel free to change it, just make sure it's purpose is obvious.)
Finally, you are overthinking your boundary checks as well.  All you need to do is simply check the index.
new.each.with_index do |row, ix_row|
  row.each.with_index do |cell, ix_col|
    if cell == 1
      new[ix_row][ix_col+1] = 1 unless ix_col+1 &gt;= row.length #copy right
      new[ix_row+1][ix_col] = 1 unless ix_row+1 &gt;= new.length # copy down
      new[ix_row][ix_col-1] = 1 unless ix_col.zero? # copy left
      new[ix_row-1][ix_col] = 1 unless ix_row.zero? #copy up
    end
  end
end