Robins keeper Jake Kean denied Jay O'Shea and Lee Novak, while Chesterfield's Gary Liddle cleared a Nathan Thompson effort off the line.
Michael Doughty hit the post after the break before helping create the winner for Kasim to curl home.
Chesterfield's Charlie Raglan then saw red for a second caution late on.
The Spireites remain four points clear of the relegation places with two games remaining after Blackpool drew 0-0 with Fleetwood Town.
Yaser Kasim scored the only goal of the game to guarantee Swindon Town's League One safety and leaves Chesterfield still in danger of relegation.