Say you have the hosts all listed in a file, you could do something like
#!/bin/sh
for host in `cat /path/to/hosts`
do
/path/to/chpass oldpass newpass $host
done
where chpass is an expect script like
#!/usr/bin/expect -f
set opassword [lindex $argv 0]
set npassword [lindex $argv 1]
set host [lindex $argv 2]
spawn ssh $host
match_max 100000
expect "*?assword:*"
send -- "$opassword\r"
spawn passwd
expect "*?assword:*"
send "$opassword\r"
expect "*?assword:*"
send "$npassword\r"
expect "*?assword:*"
send "$npassword\r"
expect eof